1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-11-25 14:17:35 +00:00

Merge pull request #46 from stmoreau/master

JavaScript language Objects section creation
This commit is contained in:
Julien Le Coupanec 2018-04-20 22:53:15 +01:00 committed by GitHub
commit 0fc96efd89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 15 deletions

View File

@ -6,14 +6,12 @@
> ❤️ **If you like this repository, [you can click here to tweet it and make it spread](https://ctt.ec/PHba4).** > ❤️ **If you like this repository, [you can click here to tweet it and make it spread](https://ctt.ec/PHba4).**
## 🤔 Why Awesome-Cheatsheets? ## 🤔 Why Awesome-Cheatsheets?
I always make a cheatsheet when I want to improve my skills on a programming language, a framework or a development tool. [I started doing these kind of things a long time ago on Gist](https://gist.github.com/LeCoupa) To better keep track of the history and to let people contribute to them, I reorganized everything into this single repository. Most of the content is coming from official documentations and some books I have read. I always make a cheatsheet when I want to improve my skills on a programming language, a framework or a development tool. [I started doing these kind of things a long time ago on Gist](https://gist.github.com/LeCoupa) To better keep track of the history and to let people contribute to them, I reorganized everything into this single repository. Most of the content is coming from official documentations and some books I have read.
Feel free to browse each cheatsheet to learn new things and to keep them at hand when you forgot about one command. They have been designed to provide a quick way to assess your knowledge and to save you time. Feel free to browse each cheatsheet to learn new things and to keep them at hand when you forgot about one command. They have been designed to provide a quick way to assess your knowledge and to save you time.
## 📚 Table of Contents ## 📚 Table of Contents
### 📃 Languages ### 📃 Languages
@ -32,8 +30,8 @@ Feel free to browse each cheatsheet to learn new things and to keep them at hand
#### Functional #### Functional
* [JavaScript](languages/javascript.js) * [JavaScript](languages/javascript.js)
</details>
</details>
### 📦 Backend ### 📦 Backend
@ -49,8 +47,7 @@ Feel free to browse each cheatsheet to learn new things and to keep them at hand
* [Feathers.js](backend/feathers.js) * [Feathers.js](backend/feathers.js)
* [Moleculer](backend/moleculer.js) * [Moleculer](backend/moleculer.js)
* [Node.js](backend/node.js) * [Node.js](backend/node.js)
</details> </details>
### 🌐 Frontend ### 🌐 Frontend
@ -65,8 +62,7 @@ Feel free to browse each cheatsheet to learn new things and to keep them at hand
* [React.js](frontend/react.js) * [React.js](frontend/react.js)
* [Vue.js](frontend/vue.js) * [Vue.js](frontend/vue.js)
</details> </details>
### 🗃️ Databases ### 🗃️ Databases
@ -76,8 +72,7 @@ Feel free to browse each cheatsheet to learn new things and to keep them at hand
#### NoSQL #### NoSQL
* [Redis](databases/redis.sh) * [Redis](databases/redis.sh)
</details> </details>
### 🔧 Tools ### 🔧 Tools
@ -95,14 +90,12 @@ Feel free to browse each cheatsheet to learn new things and to keep them at hand
* [Kubernetes](tools/kubernetes.sh) * [Kubernetes](tools/kubernetes.sh)
* [Nanobox Boxfile](tools/nanobox_boxfile.yml) * [Nanobox Boxfile](tools/nanobox_boxfile.yml)
* [Nanobox CLI](tools/nanobox_cli.sh) * [Nanobox CLI](tools/nanobox_cli.sh)
</details> </details>
## 🙌🏼 How to Contribute? ## 🙌🏼 How to Contribute?
You are more than welcome to contribute and build your own cheatsheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging. You are more than welcome to contribute and build your own cheatsheet for your favorite programming language, framework or development tool. Just submit changes via pull request and I will review them before merging.
## 🙏🏻 Contribution ## 🙏🏻 Contribution
<table> <table>
@ -119,6 +112,9 @@ You are more than welcome to contribute and build your own cheatsheet for your f
<td align="center"> <td align="center">
<a href="https://learnk8s.io/" target="_blank"><img src="https://pbs.twimg.com/profile_images/925127335573114880/9yCkEIe3_400x400.jpg" height="64" /></a> <a href="https://learnk8s.io/" target="_blank"><img src="https://pbs.twimg.com/profile_images/925127335573114880/9yCkEIe3_400x400.jpg" height="64" /></a>
</td> </td>
<td align="center">
<a href="https://www.voxygen.com/" target="_blank"><img src="https://imgur.com/XQoVtag.png" height="64" /></a>
</td>
</tr> </tr>
</table> </table>

View File

@ -1,9 +1,52 @@
/* *******************************************************************************************
* GLOBAL OBJECTS > OBJECT
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
* ******************************************************************************************* */
// Global object: properties
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.
Object.prototype // Represents the Object prototype object and allows to add new properties and methods to all objects of type Object.
// Methods of the Object constructor
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
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.
Object.defineProperty(obj, prop, descriptor) // Adds the named property described by a given descriptor to an object.
Object.defineProperties(obj, props) // Adds the named properties described by the given descriptors to an object.
Object.entries(obj) // Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties.
Object.freeze(obj) // Freezes an object: other code can't delete or change any properties.
Object.getOwnPropertyDescriptor(obj, prop) // Returns a property descriptor for a named property on an object.
Object.getOwnPropertyDescriptors(obj) // Returns an object containing all own property descriptors for an object.
Object.getOwnPropertyNames(obj) // Returns an array containing the names of all of the given object's own enumerable and non-enumerable properties.
Object.getOwnPropertySymbols(obj) // Returns an array of all symbol properties found directly upon a given object.
Object.getPrototypeOf(obj) // Returns the prototype of the specified object.
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).
Object.isExtensible(obj) // Determines if extending of an object is allowed.
Object.isFrozen(obj) // Determines if an object was frozen.
Object.isSealed(obj) // Determines if an object is sealed.
Object.keys(obj) // Returns an array containing the names of all of the given object's own enumerable string properties.
Object.preventExtensions(obj) // Prevents any extensions of an object.
Object.seal(obj) // Prevents other code from deleting properties of an object.
Object.setPrototypeOf(obj, prototype) // Sets the prototype (i.e., the internal [[Prototype]] property).
Object.values(obj) // Returns an array containing the values that correspond to all of a given object's own enumerable string properties.
// Object instances and Object prototype object (Object.prototype.property or Object.prototype.method())
// Properties
obj.constructor // Specifies the function that creates an object's prototype.
obj.__proto__ // Points to the object which was used as prototype when the object was instantiated.
// Methods
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.
prototypeObj.isPrototypeOf(object) // Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object.
obj.propertyIsEnumerable(prop) // Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set.
obj.toLocaleString() // Calls toString().
obj.toString() // Returns a string representation of the object.
object.valueOf() // Returns the primitive value of the specified object.
/* ******************************************************************************************* /* *******************************************************************************************
* GLOBAL OBJECTS > ARRAY * GLOBAL OBJECTS > ARRAY
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
* ******************************************************************************************* */ * ******************************************************************************************* */
// Global object: properties // Global object: properties
Array.length // Reflects the number of elements in an array. Array.length // Reflects the number of elements in an array.
Array.prototype // Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects. Array.prototype // Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects.