ES6 (ECMAScript 6)
ECMAScript es un lenguaje de programación de propósito general, estandarizado por Ecma International de acuerdo con el documento ECMA-262. Es un estándar de JavaScript destinado a garantizar la interoperabilidad de las páginas web en diferentes navegadores web.
1. use-class-syntax-to-define-a-constructor-function
// Only change code below this line
class Vegetable {
constructor (name){
this.name = name
}
}
// Only change code above this line
const carrot = new Vegetable('carrot');
console.log(carrot.name); // Should display 'carrot'
2. handle-a-fulfilled-promise-with-then
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to true to represent
a successful response from a server
let responseFromServer = true;
if(responseFromServer) {
resolve("We got the data");
} else {
reject("Data not received");
}
makeServerRequest.then(result => {
console.log(result)
})
});
Comentarios
Publicar un comentario