Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

I need a NodeJS/Javascript programmer for help

Hello Guys, I have a little problem with NodeJS, the code is clean but the console keeps giving me an error, which is:

'SyntaxError: missing : after property id'

This is my code

var phones = $('input[name="place[phones]"]');      
var phoneLabels = $('input[name="place[phoneLabel]"]');
 for (var i = phones.length - 1; i >= 0; i--) {            
   wizard.place.phones.push({$(phoneLabels[i]).val(): $(phones[i]).val().trim().replace(/\s+/g, ''),"description": ''});                
};
 if (wizard.currentIsValid){
     wizard.place.save();
   }
}

and according to the console, the error is on this line:

wizard.place.phones.push({$(phoneLabels[i]).val(): $(phones[i]).val().trim().replace(/\s+/g, ''),"description": ''});      

1 Answer

this is the right answer, I got it already

wizard.place.phones.push({"phone": $(phones[i]).val().trim().replace(/\s+/g, ''),"description": $(phoneLabels[i]).val()});