Standard built-in objects

String

Substring

http://www.tothenew.com/blog/javascript-slice-vs-substring-vs-substr/

Array

JavaScriptArray Reference

Function

Function Reference

Methods

Function.prototype.apply()

The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).

Note: While the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.

var numbers = [5, 6, 2, 3, 7];

var max = Math.max.apply(null, numbers);

console.log(max);
// expected output: 7

var min = Math.min.apply(null, numbers);

console.log(min);
// expected output: 2
var numbers = [5, 6, 2, 3, 7];

var max = Math.max(...numbers);

console.log(max);
// expected output: 7

var min = Math.min(...numbers);

console.log(min);
// expected output: 2

Function.prototype.call()

function Product(name, price) {
  this.name = name;
  this.price = price;
}

function Food(name, price) {
  Product.call(this, name, price);
  this.category = 'food';
}

console.log(new Food('cheese', 5).name);
// expected output: "cheese"

results matching ""

    No results matching ""