I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In most cases, the in operator is the best way to determine whether | |
| the property exists in an object. It has the added benefit of not evaluating the value of the property, which can be important if such an evaluation is likely to cause a performance issue or an error. | |
| In some cases, however, you might want to check for the existence of | |
| a property only if it is an own property. The in operator checks for both | |
| own properties and prototype properties, so you’ll need to take a different | |
| approach. Enter the hasOwnProperty() method, which is present on all objects | |
| and returns true only if the given property exists and is an own property. | |
| For example, the following code compares the results of using in versus | |
| hasOwnProperty() on different properties in person1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Removing Properties | |
| Just as properties can be added to objects at any time, they can also be | |
| removed. Simply setting a property to null doesn’t actually remove the | |
| property completely from the object, though. Such an operation calls | |
| [[Set]] with a value of null, which, as you saw earlier in the chapter, only | |
| replaces the value of the property. You need to use the delete operator to | |
| completely remove a property from an object. | |
| The delete operator works on a single object property and calls an | |
| internal operation named [[Delete]]. You can think of this operation as | |
| removing a key/value pair from a hash table. When the delete operator is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Types of Properties | |
| There are two different types of properties: data properties and accessor | |
| properties. Data properties contain a value, like the name property from earlier examples in this chapter. | |
| The default behavior of the [[Put]] method | |
| is to create a data property, and every example up to this point in the | |
| chapter has used data properties. Accessor properties don’t contain a value | |
| but instead define a function to call when the property is read (called | |
| a getter), and a function to call when the property is written to (called a | |
| setter). Accessor properties only require either a getter or a setter, though | |
| they can have both. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getCountryData = country => { | |
| const request = new XMLHttpRequest(); | |
| request.open('GET', `https://restcountries.eu/rest/v2/name/${country}`); | |
| request.send(); | |
| request.addEventListener('load', function () { | |
| const [data] = JSON.parse(this.responseText); | |
| console.log(data); | |
| countriesContainer.insertAdjacentHTML('beforeend', html); | |
| countriesContainer.style.opacity = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git add -A | |
| git stash | |
| git checkout master | |
| git pull origin master | |
| git checkout development(branch) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "printWidth": 80, | |
| "tabWidth": 2, | |
| "useTabs": false, | |
| "semi": false, | |
| "singleQuote": true, | |
| "trailingComma":"none", | |
| "bracketSpacing": true, | |
| "jsxBracketSameLine": false | |
| } |
将设置放入此文件中以覆盖默认设置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { | |
| padding: 0; | |
| margin: 0; | |
| list-style: none; | |
| border: none; | |
| text-decoration: none; | |
| box-sizing: border-box; | |
| -webkit-overflow-scrolling: touch; | |
| } |