Hi, I am new to coding and I am practicing to get more comfortable with each topic in JavaScript.
Sometimes when I type out multiple values in a ‘console.log()’, the quotation marks (’ ‘, " ",
, included) would highlight the wrong part of code. In the topic ’ Advance Objects: 7. Factory functions’, https://www.codecademy.com/courses/introduction-to-javascript/lessons/advanced-objects/exercises/factory-functions . the code:
const robotFactory = (model, mobile) => {
return {
model: model,
mobile: mobile,
beep() {
console.log(‘Beep Boop’);
}
}
};
const tinCan = robotFactory(‘P-500’, true);
tinCan.beep()
works completely fine. However if you wanted to change ‘true’ as a string (const tinCan = robotFactory(‘P-500’, ‘true’). This will highlight the closing bracket as the string, and the colour of ‘true’ changes to purple. I don’t understand how this works, and this happens when you also add more values. Please help, thank you