javascript - Looking for answer to JavaSript coding quiz -
/* * programming quiz: 1 awesome message (2-12) * * 1. create variables * - firstname * - interest * - hobby * 2. create variable named awesomemessage and, using string concatenation , variables above, create awesome message. * 3. print awesomemessage variable console */ // add code here i cannot print awesomemessage variable console this:
"hi, name julia. love cats. in spare time, play video games."
"hi, name james. love baseball. in spare time, read."
i new this... please don't judge me. here code wrote (and stuck on):
firstname = ["julia", "james"]; interest = ["cats", "baseball"]; hobby = ["play video games", "read"]; var awesomemessage = "hi, name " + firstname +". " + "i love "+interest+ ". "+ "i "+hobby+ "."; console.log(awesomemessage);
i've updated answer use strings instead of arrays. check out how compares had.
//declaring variable using var keyword defines scope var firstname = "julia"; var interest = "cats"; var hobby = "play video games"; //concatenate our vars longer string var awesomemessage = "hi, name " + firstname + ". " + "i love " + interest + ". " + "i " + hobby + ".\n"; //see result of string concatenation console.log(awesomemessage);
Comments
Post a Comment