I make a route application on Yandex maps with Yandex API.
There is a line:
ymaps.route( [routeFrom, routeIn, routeIn2, routeIn3, routeIn4, routeIn5, routeTo], {mapStateAutoApply:true}) routeFrom , routeIn , routeIn2 and so on are input fields, or rather their values
var routeFrom = document.getElementById ('route-from'). value
That is, the routeFrom field is the starting point, routeTo is the destination. routeIn , routeIn2 , routeIn3 , routeIn4 , routeIn5 are intermediate points.
It turns out that the user must fill in the routeFrom and routeTo fields, but the routeIn, routeIn2, etc. - not necessary.
But it turns out that if the user did not fill in the routeIn field (or did not fill in all (but all of them are 5)), in this case, it gives an error, because here they are declared:
ymaps.route( [routeFrom, routeIn, routeIn2, routeIn3, routeIn4, routeIn5, routeTo], {mapStateAutoApply:true}) Is it possible to somehow check the fields for fullness, and if they are filled, then substitute them into this function?
I would be very grateful for the help!