if
,else
,while
,for
,do
var a = 'foo';
function b(){
return a;
}
b();
- array methods:
.filter
,.map
,.reduce
,.find
, etc.
function Foo(){}
Foo.prototype.bar = function(){}
var foo = new Foo();
var foo = {
bar: 'bar'
};
var items = {};
function add( key, value ) {
items[key] = value;
}
function get( key ) {
return items[key];
}
function exists( key ) {
return !!items[key];
}
function remove( key ) {
delete item[key];
}
- https://blog.risingstack.com/asynchronous-javascript/
- https://www.sitepoint.com/javascript-goes-asynchronous-awesome/
console.log('a');
setTimeout(function(){
console.log('c');
}, 1000);
console.log('b');
// works in node via:
// > node name-of-this-file.js
const fs = require( 'fs' );
fs.readFile( 'package.json', ( err, file ) => {
console.log( file.toString() );
});
- Scopes and Closures
this
and Object Prototypes
Work through examples