Javascript Primer Quiz - Variables
How do you declare a variable named age with a value of
25?
let age = 25create age = 25let age = #25
let answer
tests({
'answer is correct': (t) => {
t.isEqual(answer, 1, `${answer === undefined ? "You haven't submitted an answer yet" : "Not quite, try again"}`)
}
})
How do you assign a value to a variable?
You have a variable named name which currently has a value
of "Alex", and you want to change the value to
"Ahmad". Which line of code would you use?
name => "Ahmad"name is "Ahmad"name = "Ahmad"let name = "Ahmad"
let answer
tests({
'answer is correct': (t) => {
t.isEqual(answer, 3, `${answer === undefined ? "You haven't submitted an answer yet" : "Not quite, try again"}`)
}
})
What is the value of this variable?
After the below code has been run, what is the value of the
bird variable?
let bird = "Tui"
bird = "Kiwi"
"Tui"undefined"Kiwi""kiwi"
let answer
tests({
'answer is correct': (t) => {
t.isEqual(answer, 3, `${answer === undefined ? "You haven't submitted an answer yet" : "Not quite, try again"}`)
}
})
Congratulations!
You've completed the whole quiz!