Split the mass on two parts
Hello. How can the mass be broken into two parts at the right place if the element of the required index is repeated. For example, I need the last number in terms 45-23*996-25 (how do I smash the mass at the second minus)? Thank you.
Bogopo last edited by
split- It's possible to turn the line into a mass, to break it down by the divider.
popremoves the last element from the mass and returns its value.
var test = '45-23*996-25'; var last = test.split('-').pop();