say_hello = function() {
alert('Hello world!');
}
say_hello
, this variable holds a function
function_name = function(optional arguments list) {
...
}
a variable is a way to store a value in our program
the = is used to assign to the variable
it takes the value on the right and stores it in the variable named on the left
Numbers can be stored and calculated on in probably the obvious ways
count = 7
pi = 3.1416
more = count + 1
twice_as_much = count * 2
strings are sequences of characters (text)
greeting = 'Hello'
name = "Becky B Barrington"
personal_greeting = greeting + ' ' + name
an object is a value in JavaScript that can contain other things:
numbers, strings, functions, other objects, ...
the two important types of the objects we are interested in are arrays and JSON objects
a
and b
are both numbers:
result = a - b
the Browser Object Model (BOM) allows JavaScript to "talk to" the browser
it is served through the window
object
window
objectwindow
object
document
Objectthe object which represents your webpage parsed model
lets look at its use cases here
console
ObjectThe Console object provides access to the browser's debugging console
lets look at its use cases here
you may leave comments on your code while developing using JavaScript
You can learn about commenting syntax over here