var obj = {
Fname1: "John",
Lname1: "Smith",
Age1: "23",
Fname2: "Jerry",
Lname2: "Smith",
Age2: "24"
}
with an object like this.Can i get the value using regex on key something like Fname*,Lname* and get the values.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, sure you can. Here’s how:
This was the regex way, but for simple stuff, you may want to use
indexOf(). How? Here’s how:And if you want to do something with a list of attributes, i mean that you want values of all the attributes, you may use an array to store those attributes, match them using regex/indexOf – whatever convenient – and do something with those values…I’d leave this task to you.