Most voted "ecmascript-6" questions
This tag is NOT synonymous with [javascript] and [typescript] tags. Also NOT to be used when the doubt is about technical problems of use (difficulties) or third party libraries, it should be used only for doubts about the specifications of the sixth edition (ES6/Ecmascript® 2015).
Learn more…132 questions
Sort by count of
-
2
votes0
answers1259
viewsWhat is Arrow Function and when to use?
I’m having a question, I’m studying ES6 but I don’t really understand what the Arrow Function replaces, I researched and I saw that it’s the function this. I would like to know better with an…
-
2
votes2
answers192
viewsHow to define conditional properties for a literal object in the leanest way possible with Javascript?
I would like to know how to add conditional properties to a literal object in the leanest way possible. I currently declare the object and then add the conditional properties as in the following…
-
2
votes1
answer226
viewsMake React components available as dependency
blz? i have some React components here and need to make all of them available in one dependency only, semantic style, how can I do this? i am trying to export the components on an index importing…
-
2
votes0
answers79
viewsDifference between@ and . / in the import function
I would like to know the difference between the codes below: import module from '@module' import module from 'module' I recently had a problem where I had to stop using import firebase from…
-
2
votes1
answer669
viewsHow to break lines according to a value
How do I break lines according to the value ? For example a = 8. There I have a variable "d" q takes a string. var d = "written work considered in its original wording". If I put an If = a; it…
-
2
votes1
answer5537
viewsHow to resolve: Failed to execute 'appendchild' on 'Node': Parameter 1 is not of type 'Node'
I’m having a problem with an ES6 application. I am creating a table that receives values from a form, but whenever I click on the button to send the information to the table, from the following…
-
2
votes1
answer44
viewsBrowsers and ES6
I am starting my studies in ES6 and my course is 2018, I would like to know if the browsers already support the technology or is still necessary the use of the compilers?
-
2
votes1
answer89
views$(this) in Arrow Function returns different element
See that the $(this) in each case below points to a different element: 1º) Function: $("button").click(function(){ $("input").val(function(){ return $(this).val(); }); }); ↑ ↑…
-
2
votes2
answers79
viewsGoing through an archive of constants
I created the following constant file (constants.ts): export const USER_INFO = 'user-info'; export const USER_SEARCH = 'user-search'; export const USER = 'user'; This file is used to set, retrieve…
-
2
votes1
answer25
viewsDisplay data stored in the Weakmap object
var Pessoa = (function(){ var dadosPrivados = new WeakMap(); function Pessoa(nome, idade, sexo){ dadosPrivados.set(this,{nome: nome}); dadosPrivados.set(this,{idade: idade});…
-
2
votes2
answers223
viewsMerge an Object with an ES6 Javascript Object Array!
Staff I have the following variables! let content = { cd_empresa: 200, cd_produto: 13287, cd_status: 604, dt_validade: '2019-05-09T12:34:00', dv_possui_subvencao: 1, dv_regra: 1, fl_possui_item: 1,…
-
2
votes2
answers336
viewsI’m having import and export problems using ES6
I am using Google Chrome as a browser and when I try to run the code, this error appears. And I saw that in the HTML file I can use type="module", however, two other errors appear. The first error…
-
2
votes1
answer51
viewsChanging the default value of a parameter in a function is possible?
I have an array of functions, and I need to change the default value of the parameter with another value for each of them, in a loop.. Is that possible? Ex: var externalValidations = [ function…
-
2
votes1
answer118
viewsHow to return a Promise from the resolution of others?
I’m relatively new to this Promises, despite having used them numerous times, especially in AJAX requests. I’m building a front-end application that runs on Sharepoint and, to get a lot of…
javascript internet-explorer promises ecmascript-5 ecmascript-6asked 5 years, 6 months ago J. L. Muller 555 -
1
votes1
answer219
viewsReserved word usage "import" in javascript
Reading the Ghost code, CMS platform based on Nodejs found a file with the following statement: import Ember from 'ember'; import Resolver from 'ember/resolver'; import loadInitializers from…
-
1
votes0
answers73
viewsHow to convert ES6 to ES5 in Cordova via a hook?
Cordova’s crosswalk plugin does not work on iOS, so iOS Webview continues to be native. The problem is that native Webview (safari) does not run ES6, but my project is written in ES6. I need a kind…
-
1
votes3
answers57
viewsTHIS object in conflict between jQuery and ECMA6 class
How to resolve the conflict between the this of a jQuery loop performed within a javascript class method (ECMA6)? Example, the metodoUm loops using jQuery and for each loop iteration, calls the…
-
1
votes1
answer71
viewsUsing ES6 Proxies with ES6 Maps
I’m about a day and a half researching about Maps and Proxies to go deeper into the issue of looking at arrays, objects and so on. But I came across a problem, I can’t use the Proxy in the Map. When…
-
1
votes2
answers77
viewsString#codePointAt or String#charCodeAt?
New methods similar to Ecmascript 6 have been added to String.fromCharCode() and String#charCodeAt(): String.fromCodePoint() and String#codePointAt(). What’s the difference between them?…
-
1
votes1
answer73
viewsReferencing an import dynamically
Below I’m setting some Imports; import users from './user'; import securities from './security'; import softwares from './software'; and I want to be able to access them in the course of my file,…
-
1
votes3
answers1246
viewsRegular expression for 2 specific cases
I wanted two regexp to standardize a field. Follows the two values I need a regular expression. 1-167106651950 A number from 0 to 9, a mandatory dash and 12 more numbers from 0 to 9. SP4:01:342310…
-
1
votes1
answer296
viewsHow to access an object nested in another object dynamically?
I have the following JSON { "Id":"ssjsjs", "Name":"STFksks S.A", "Alias":"STF jnsns S.A", "DocumentId":"010101", "Accounts":[ "hahadkjkjteste" ], "CountryCode":"BRA", "Country":"Brasil", "Address":{…
-
1
votes1
answer33
viewsClass attribute in constructor
I can access a class attribute within the constructor scope, but outside gives 'Undefined' constructor(errorAlert){ this._errorAlert = errorAlert; } If, for example, in the code above, I give…
-
1
votes1
answer71
viewsIs it possible to use Ecmascript 6 without Babel or Webpack?
As in the old days, it would be possible to simply include an Ecmascript 6 file in the browser and use its functionalities without the need to "transpose" these codes?
-
1
votes1
answer174
viewsIs "use Strict" still useful with the new features brought in Ecmascript 6?
Ecmascript 6 brings the resources let and const, that prevent variables from being redeclared and overwritten unintentionally, and limit the scope of the variables created. The question is: with…
-
1
votes1
answer73
viewsObject.Reeze Javascript
How can I give a Object.freeze in just one object? Follow example below where I create a, replicatic a in b, freezo the b, and I try to re-assign a value to a. But it’s no longer possible. Why? How…
-
1
votes2
answers75
viewsHow to modify an object array through a condition?
I have the following object array: let items = [ { carro: { title: "Gol", description: "Gol quadrado", active: true, }, isVisible: true, }, { carro: { title: "Gol Filho", description: "Gol…
-
1
votes1
answer60
viewsMerge 2 objects with Javascript ES6!
I have the following javascript objects.. headers: [ { text: 'Nome', value: 'nm_propriedade' }, { text: 'Área Segurada', value: 'nr_area_risco' }, { text: 'Início de plantio', value:…
-
1
votes1
answer99
viewsCount of arrays inside an object!
I have an object with arrays inside, inside that array.. there are other objects! how can I know the total length of all arrays inside the first object! ex: let items = { 0: [ { foo: 'foo' }, { bar:…
-
1
votes1
answer882
viewsWhat does this reticence mean in the array?
I saw that ES6 tends to be cleaner, but I can’t understand some things: 1. What exactly is this reticence doing, in theory? function getHiddenHTML(el) { return [...el.childNodes].reduce((txt, node)…
-
1
votes1
answer42
viewsCreating a list of elements traversing an associative array in Ecmascript
I’m trying to create a top menu piece with Ecmascript instead of pure html, but I’m not getting what’s left to add the element. Code HTML <div class="rd-navbar-cell rd-navbar-nav-wrap"…
-
1
votes1
answer58
viewsHow does the Symbol() data type work?
The type of data Symbol() has been implemented in the language since version 6 or 2015, but I did not understand its actual use. Looking at some practical examples found on the web, I saw examples…
-
0
votes1
answer397
viewsDifference between two arrays with Typescript or ES6
How can I get the difference between two Arrays of objects using TypeScript or ES6? I tried to do using SET: let arr1 = new Set(lista1); let arr2 = new Set(lista2); let difference = new Set( [arr1…
-
0
votes1
answer242
viewsTranspiling ES6 to ES5 using Babel
I have a package.json file set up to take all js files from a directory and join them into a new file, transpiling to ES5. However, it is only creating a new file and unifying all js files from the…
-
0
votes1
answer38
viewsIntegrate ES2015 Classes with jQuery
After much reading I finally managed to do the Babel work and thus transcompile the scripts. Before using das, let’s call ES2015 classes, after reading about best practices I had something like…
-
0
votes1
answer1513
viewsHow to identify the child element clicked through the event click on the parent element
I have the following code: <div class="tipo-cadastro"> <div class="box-logista active">Logista</div> <div class="box-distribuidor">Distribuidor</div> </div> and…
-
0
votes1
answer247
viewsWhich framework do you recommend for javascript unit testing (Ecmascript 6)?
I will develop a web application using Ecmascript 6. I’d like to continue with the TDD Technique. What framework do you recommend for javascript unit testing (Ecmascript 6)?
-
0
votes1
answer45
viewsModal does not result from updated validation error when submitting a $http() request
Strange problem, with $uibModal Angularjs, when using JSON.stringify(object, null, ' '), it does not show the full return in the modal result: { "permission": true, "title": "ALUNO: aDSadaD",…
-
0
votes2
answers950
viewsIs there any method for me to create translations of pages with Javascript or Typescript?
I wonder if there is any method for me to create my own translations of static pages with Javascript.
-
0
votes2
answers601
viewsWhat is the difference between map() and lenght()?
I was studying and this code appeared: var materials = [ 'Hydrogen', 'Helium', 'Lithium', 'Beryllium' ]; console.log(materials.map(material => material.length)); As I understand it, it scans the…
-
0
votes0
answers29
viewsWhen to use literal array notation in JS?
I started using the Jshint in my projects, together with the Sublime Linter (which, by the way, I recommend). After doing the setup I came across the following warning:: The literal array Notation…
-
0
votes2
answers180
viewsAjax request in ES6 constructor
How I make a request in my constructor Ajax and assign the values of that request to my attributes? So far it’s like this and it’s not working, I’m returning 2 jsons... in the console.log attributes…
-
0
votes0
answers28
viewsHow to make a setTimout but only when there is no action on the screen?
I’m looking for an idea, as I do a Settimout only when the user leaves the page. Example, I’m with 2 screens. One is the Reset screen and another is the home. when user enters the system he goes…
-
0
votes0
answers360
viewsHow to use Addeventlistener() in vueJs
I’m doing a function of my project and need to use the event addEventListener() but you’re making a mistake: excluirVariante:function(v){ console.log(this.$el.querySelector('#op_nao'));…
-
0
votes1
answer103
viewsHow to leave a field to select names in alphabetical order
I wonder if you have any function of typescript or javascript that performs this organization in alphabetical order. if yes which and how to use it
-
0
votes1
answer235
viewsDid inverted string quote support appear in Ecmascript 6?
Inverted quotes used in strings like `exemplo` were added to Ecmascript 6? I wonder if this came up in this version. PS: I don’t believe the question is duplicated, because my question is whether…
-
0
votes1
answer31
viewsIs it possible to use addEventListner this way?
I’m studying javascript and decided to play a little with the creation of fields with the CORE GIFT. This is the code I’ve made so far : <!DOCTYPE html> <html lang="en"> <head>…
-
0
votes1
answer76
viewsHow to use Methods of a Extends Class?
I have two classes : A and B Class B is like this: B extends A I need to use some methods that has within the Class To, in class B . How I do? class NeorisMapBi { constructor(mapID, mapOBJ){…
-
0
votes1
answer92
viewsUse imported js file in html in an ES6 application
I am developing an application with ES6 and doing the build with Webpack. This application will be in a template that already imports jQuery via <script src...></script>. How would I…
-
0
votes2
answers379
viewsUsing the filter method an object array
I have an array of objects: const musicData = [ { artist: 'Adele', name: '25', sales: 1731000 }, { artist: 'Drake', name: 'Views', sales: 1608000 }, { artist: 'Beyonce', name: 'Lemonade', sales:…