Practice Modern JavaScript
vaScript using async
Eine Kesselplatte zum Einrichten und Üben moderner JavaScript
1. Installieren Sie nodemon global, um nach Dateiänderungen zu achten, während Sie den Code ausführen? ?
$ npm install -g nodemon # npm i -g nodemon2. Alle Abhängigkeiten installieren ? ?
$ yarn install1.. Beobachten Sie nach Dateiänderungen?
$ yarn run watch # yarn start 2. Schreiben Sie modernes JavaScript in src/index.js -Datei
// my-module.js
export const name = 'My Module' // index.js
import * as myModule from './my-module'
console . log ( myModule . name ) // 'My Module'3. Genießen Sie die Ausgabe?
$ yarn start
My Module1. Beispiel 1 ⮭
// async-await.js
const prom = new Promise ( resolve => {
resolve ( `Hello` )
} )
const longRun = async ( ) => {
const res = await prom
console . log ( res )
}
longRun ( )2. Beispiel 2 ⮭
// array-includes.js
const includes3 = [ 1 , 3 , 4 ] . includes ( 3 )
console . log ( includes3 ) Abhisek Pattnaik ? |
|---|
Dieses Projekt folgt der All-Contributors-Spezifikation.
Alle Arten von Beiträgen sind willkommen
Mit © Abhisek Patnaik
Tweet @abhisek
Wissen über/abhisekp
Chatten Sie mit @abhisekp