JavaScript
This section includes notes I took when taking the JavaScript tutorial from Scrimba.
document.getElementById("element-id")
: gets the element using its ID..innerText
andtextContent
:.innerText
modifies the element's text (only human-readable content), including HTML tags.textContent
modifies the element's text and all its children that are for formatting purposes only.variable = variable + something
equals tovariable += something
if ... else statement
if (sum < 21) {
console.log()
} else if (sum === 21){
console.log("Wohoo! You've got blackjack!")
} else if (sum > 21){
console.log("You're out of the game")
}
// or
if (sum < 21) {
console.log()
} else if (sum === 21){
console.log("Wohoo! You've got blackjack!")
} else (sum > 21){
console.log("You're out of the game")
}