Questions tagged as 'ecmascript-6'

2
answers

What does function ({Something, something More, still More}) {} mean? in Javascript

Watching a tutorial I found an expression like this: function ( { algo, algoMas, todaviaMas } ) { } Doing a bit of research, I found Destructuring in ES6 : The unstructured data, or    destructuring named parameter: "destru...
asked by 22.08.2018 / 23:56
2
answers

Difference between new Array () in ES5 and Array.of () in ES6 in JavaScript

When we use the Constructor new Array() in ES5 to build a new fix we do the following: EXAMPLE 1 let elementos = new Array(2); console.log(elementos[0]); console.log(elementos[1]); //ambos console darán undefined Howeve...
asked by 30.09.2018 / 04:01
1
answer

Arrow Functions in (IE) Internet Explorer 11

I have AngularJS (1.5.5) and doing testing, the arrow functions do not work in Internet Explorer 11, I have the following code: return availability.price && availability.options.filter(x => x.leadTime >= 0).length > 0; And...
asked by 27.07.2018 / 02:03
1
answer

How can I use "let" out of a block in javascript?

I'm experimenting with JavaScript and I came across this variable scope in JavaScript, mainly with let , which is integrated in ECMAscript 6. The problem is this: I have a prompt that asks the user for their age and compares it in a...
asked by 01.12.2016 / 04:52
1
answer

ES6 undefined $ {this.name}

Friends I'm trying the following class Player{ //todo lo que resiba este const será la clase persona constructor(nombre,edad){ nombre == this.nombre; edad == this.edad; } mA(){ console.log('la edad es...
asked by 30.12.2018 / 03:56
1
answer

Error saving a JavaScript promise in a variable

How can I save a value of a promise in javascript already tried with this function loadImage(url){ return new Promise((resolve, reject) => { const image = new Image(); image.addEventListener('load', () => {...
asked by 18.07.2018 / 04:31
1
answer

Avoid self = this by using arrow functions ES6

In a JavaScript class, I have a function that calls a callback using a constructor's own variable. To not copy the entire class I will write an example: class Foo { constructor(bar) { this.bar = bar; } async_print() {...
asked by 21.08.2018 / 21:51
1
answer

Convert JavaScript Object Array

You would need to convert an object returned from an AJAX call to another object with different properties. The object in question has a structure similar to this: [ { campo1: "algun valor", campo2: { Id: 12345567, Nombr...
asked by 08.08.2018 / 22:59
1
answer

Get the name of a promise - async

I understand that if you have a function you can get the name with the property name and if it is a class you can get the name prototype.name but as I get the name of a promise, the problem is as follows I have several functions ty...
asked by 12.12.2018 / 14:29
1
answer

calculate average and percentages in javascript

How I need a little help, I have the following arrangement: And what I need is to transform quantity in%, corresponding to the total average of all the amounts, that is: the total sum of quantity is 791 which is equival...
asked by 24.07.2018 / 20:24