Professional Documents
Culture Documents
// const is constant; use it unless you know you're going to reassign the value
// Concatenation
console.log('My name is ' + name + ' and I am ' + age + ' years old.');
// Template string
console.log(hello);
/* multi
line comment*/
// For
console.log(todo.text)
// While
let i = 0
i++
}
todos.forEach(function(todo) {
console.log(todo.text)
})
return todo.text
})
console.log(todoText)
}).map(function(todo) {
return todo.text
})
console.log(todoCompleted)
|| or
&& and
? then
// class {
class Person {
this.lastName = lastName
getBirthYear() {
return this.dob.getFullYear()
getFullName() {
// Instantiate object
console.log(person1)
console.log(person2.getFullName())
const ul = document.querySelector('.items')
// ul.remove()
// ul.lastElementChild.remove()
ul.firstElementChild.textContent = 'Hello'
ul.children[1].innerText = 'Brad'
ul.lastElementChild.innerHTML = '<h1>Hello</h1>'