Questions tagged as 'ecmascript-6'

1
answer

JavaScript: Differences between import and require

I know that import and require are used in JavaScript to import functions or third-party objects. It is common for code snippets like: import Library from 'some-library'; or const Library = require('some-library'); Howeve...
asked by 20.06.2017 / 04:37
2
answers

ES6 classes do not allow declaration of properties?

I was experimenting with the class declaration syntax of ES6 / ES- 2015, and could not declare properties, only methods: class Teste { constructor() { } metodo() { } // não funciona: //propriedade: valor } Is...
asked by 04.01.2017 / 17:22
1
answer

Animations in high quality

We all know that animations on the web are a bit unfriendly to the eye, when you open a side menu, either in mobile or desktop , you can only see part of your movement, giving the impression of a component static without life, even...
asked by 09.03.2018 / 14:09
2
answers

Doubt in the declaration between expression arrow and expression of function of an event

I have the following code snippet: self.addEventListener('push', event => {"code here"}); My question is ... this writing format is equal to: self.addEventListener('push', function(event) {"code here"}); And if not, what's the diffe...
asked by 03.11.2016 / 13:19
2
answers

Semicolon (;) in ECMAScript 6 is no longer needed? [duplicate]

When using ECMAScript 6 (ES6) is it no longer necessary to use a semicolon (;) at the end of each line of code?     
asked by 29.12.2016 / 18:03
2
answers

Apply immutability effect on objects of an ECMA6 JavaScript class

For example, I have the following class: class LavarCarro { constructor(cor, placa, data_entrada) { this._cor = cor; this._placa = placa; this._data_entrada = data_entrada; Object.freeze(this); // congela a...
asked by 10.07.2017 / 13:56
1
answer

Difference between yield and yield * operators in ECMAScript 6.0 "Harmony"?

I'm studying the use of generators in ECMAScript 6.0 "Harmony" . I have already been able to understand its basic operation, such as declaration through the function* () { ... } syntax and the production of values through the yie...
asked by 11.12.2013 / 20:01
3
answers

How to move an object in javascript?

How to scroll through the object below with javascript? (in the same way that the arrays are run with the map ()). var obj = { "column01": "Coluna 01", "column02": "Coluna 02", "column03": "Coluna 03", "column04": "Coluna 04", "colum...
asked by 23.12.2016 / 19:30
5
answers

Get clicked item position

I have a list with registered items and one of the attributes of this item is a button to delete that item. By clicking on the button I want to know the position of the line clicked inside the list. When I know the position, I'll delete th...
asked by 01.11.2017 / 19:41
2
answers

How does hoisting work on ES6?

For example, using var , when calling the function below this way: function funcao(){ console.log(foo); var foo = "mensagem"; } funcao(); It will return undefined because of hoisting , which moves the variable foo...
asked by 27.02.2018 / 14:06