Jump to content

.substr doesn't allow variable


Mudsaf

Recommended Posts

Somehow i can't get my JSON, JavaScript & jQuery function working.

 

item = selectData.selectList[i].selectLevel.length; //Example Returns 2console.log(selectData.selectList[i].selectLevel.substr(item,1)); //Doesn't work gives empty string
item = 2; //Returns 2console.log(selectData.selectList[i].selectLevel.substr(item,1)); //Works gives received string

I've tried parseInt() function on item and everything but just cant seem to get it working.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...