Jammie Mountz

Software Engineer

JavaScript 101 – what trips up beginners

Here’s some common pitfalls JavaScript beginners fall into and their clarifications.

Object literals: “string.” 9 true
Expressions: a combination of object literals with operators (+-*/)
You can combine expressions to form compound expressions.
Expressions will “evaluate to” a result.
Anything outside of that result, e.g. something rendered on the browser/console, is a side effect.
An expression becomes a statement with the addition of the ; , such as an “if statement.”

An assignment of a label to data that can be referred to later on. The expression itself is immediately evaluated on assignment

literal notation
obj[‘key’] = “value”;
dot notation
obj.key = “value”
property lookup

For-In loops and For loops:
For-In will iterate through every property on an object.
For loops iterate through numbered properties, used on array.

var myFunc = function(num){ return num; }
num is the parameter
3 is the argument
you can reference the arguments object within the function, which has a “length” property similar to an array.

Fluent in Spanish and JavaScript, salsa dancer, lover of material design.

Living in San Francisco, CA