Jump to content

Combine strings to call on array?


ChrisDos

Recommended Posts

You can access object properties using square brackets, but you should do a check that the property exists before trying to access it.

var day = "sunday";
object[day + "Col"];

 

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...