function sayThanks(name) {
console.log("Thank you for your purchase " + name + “! We appreciate your business.”);
}
sayThanks(“Cole”);
Why do I have to put quotations around the name Cole for the code to run?
i.e. Why won’t sayThanks(Cole); run?
function sayThanks(name) {
console.log("Thank you for your purchase " + name + “! We appreciate your business.”);
}
sayThanks(“Cole”);
Why do I have to put quotations around the name Cole for the code to run?
i.e. Why won’t sayThanks(Cole); run?
It has to do with character data, which is delimited by quotes, as in string
type. Remove the quotes and the interpreter will see it as an identifier and will look to the namespace for that variable reference.
var cole = "Cole"
sayThanks(cole)
See how that works?
Yes, that’s a really helpful description.
Thanks