var x = [1, 2, 3];
var y = x;
console.log(x);
x.reverse();
x[0] = 0;
console.log(y); // what would be the result?
console.log(y.length);
var str = "I'm a string",
strObj = new String("I'm a string");
console.log(typeof(str));
console.log(typeof(strObj));
console.log(typeof(str) == typeof(strObj));
console.log(typeof(str) === typeof(strObj));
collection of objects made available by the browser
browser dependent
most important (for us): window, document (DOM)
clicks
keystrokes
mouse movement
...
<a href="http://google.com" onclick="alert('Goodbye');">Google</a>
-- or --
<!-- html -->
<a href="http://google.com">Google</a>
<!-- js -->
document.getElementsByTagName("a")[0].onclick = function() {
alert("Goodbye");
};
-- or -- allows you to register more than one handler
<!-- html -->
<a href="http://google.com">Google</a>
<!-- js -->
document.getElementsByTagName("a")[0].addEventListener("click", function() {
alert("Goodbye");
});