krulik
7/13/2016 - 7:43 AM

DevTools ex.

1 + 1
“foo”
1  + “foo”
alert(42)
confirm(“Are you sure”)
true
false
5 === 42
true === false
true === 1
true == 1
document.querySelector(“h1”)
document.querySelector("h1").textContent = 42
document.querySelector("h1").style.color = "red"
document.querySelector("h1").setAttribute("hidden", "")
document.querySelector("h1").removeAttribute("hidden")
var h1 = document.querySelector("h1") (store a value or object)
h1.style.textDecoration = "underline"
new Date()
Math.max(4, 2)
Math.random()
Number(“42”)
Number(“foo”)
Number("foo") === NaN
var foo = Number("foo")
isNan(foo)
function doSomething () { console.log(42); }
doSomething();
if (5 < 42) { doSomething(); }
if (5 > 42) { doSomething(); } else { console.error("can't do"); }
h1.addEventListener("click", doSomething)
h1.removeEventListener("click", doSomething)
window.setTimeout(doSomething, 3000)
var id = window.setInterval(doSomething, 5000)
window.clearInterval(id)