const q = 'questions';
const a = 'answers';
let s = `Sometimes the ${q} are complicated and the ${a} are simple.`;
23
Slide 24
Slide 24 text
24
Slide 25
Slide 25 text
var q = 'questions';
var a = 'answers';
var s = 'Sometimes the ' + q + ' are complicated and the ' + a + ' are simple.';
25
Slide 26
Slide 26 text
26
Slide 27
Slide 27 text
Multiline Strings
27
Slide 28
Slide 28 text
const l = `Unless someone like you cares a whole awful lot,
Nothing is going to get better.
It's not.`
28
Slide 29
Slide 29 text
var l = 'Unless someone like you cares a whole awful lot,\n Nothing is going to get better.\n It\'s not.';
29
Slide 30
Slide 30 text
var l = 'Unless someone like you cares a whole awful lot,\n' +
' Nothing is going to get better.\n' +
" It's not.";
30
Slide 31
Slide 31 text
31
Slide 32
Slide 32 text
Spread Operator (...)
32
Slide 33
Slide 33 text
let colors = ['Red', 'Blue'];
let words = ['One', 'Two', ...colors];
33
Slide 34
Slide 34 text
function fish() {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i], 'fish.');
}
}
fish(...words);
// > One fish.
// > Two fish.
// > Red fish.
// > Blue fish.
34
function feed(monster) {
var nomnoms = Array.prototype.slice.call(arguments, feed.length);
nomnoms.forEach(function (nom) {
monster.eat(nom);
});
};
49
Slide 50
Slide 50 text
New String APIs
50
Slide 51
Slide 51 text
Including, but not limited to:
4 String.prototype.startsWith()
4 String.prototype.endsWith()
4 String.prototype.contains()
4 String.prototype.repeat()
4 String.prototype.normalize()
51
Slide 52
Slide 52 text
New Array APIs
52
Slide 53
Slide 53 text
Including, but not limited to:
4 Array.prototype.find()
4 Array.prototype.findIndex()
4 Array.prototype.fill()
4 Array.prototype.includes() (ES2016)
53
Slide 54
Slide 54 text
Array.from()
54
Slide 55
Slide 55 text
let inputs = document.querySelectorAll('form input');
for (var i = 0; i < inputs.length; i++) {
inputs[i].disable = true;
}
55