Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

484 questions
-1
votes
3 answers

How to push new value into array of object in React

I think it might be silly question to ask but trust I am new to React . I am trying to push new key and value to array of object but I am not able to do it . Could someone please help me how to achieve my goal. Thanks Code this.state=…
Jonas
  • 405
  • 3
  • 7
  • 18
-1
votes
1 answer

How to get multiple select box values and texts together using jQuery?

I have a select box and user can select multiple colors so I want to get values and texts of selected options with bellow code I just get texts or just get values but I want both selected_colors = $('.selectpicker option:selected') …
Hassan
  • 362
  • 1
  • 3
  • 17
-1
votes
4 answers

Create Javascript Array with known size / performance

I refactored this code already, but it still feels like this could be written better (without external libs). Any suggestions? // Old const filters = []; for (let i = 1; i < 54; i += 1) { const currentDateDisplay = getStartDate(i, new…
phifa
  • 856
  • 7
  • 11
-1
votes
1 answer

TypeError: Cannot read property 'map' of undefined in React

I am getting error TypeError: Cannot read property 'map' of undefined . Well, I have object of array and I am extracting object keys but when I map a function then it give me error could someone please help me how to solve my problem . I tried but I…
-1
votes
2 answers

remove duplicate object from array according 2 key

i have array of objects like this , i want to remove duplicated item according 2 key, in my data, i want to delete items which have same room_id and mdate, in below code object 4 and 5 have same room_id and mdate so i should delete one of them, any…
devmrh
  • 1,171
  • 4
  • 19
  • 46
-1
votes
2 answers

How can I turn the reverseString function into a variable like sum. Is there a difference?

I want to learn how to clean my code up and I feel like the reverse string function can be turned into a variable. Is this possible? function reverseString(str) { return str.split('').reduce((revString, char) => char + revString, ''); } const…
Nellz
  • 29
  • 6
-1
votes
2 answers

javascript async await with react. setState doesn't wait forawait

I am building a component tat get the members of a group and then download the image from the api. It uses async await in the componentDidMount and the photos come back correctly. however even though I am using async await. it doesn't wait for the…
Rodney Wormsbecher
  • 897
  • 2
  • 17
  • 39
-1
votes
3 answers

Group many arrays into one based on object properties

I'm working on an e-commerce website. I have to manage product variations. The REST API response looks something like this: "variations": [ { "attributeCombinations": [ { "name": "Color", "valueName": "GRIS" }, …
brda
  • 21
  • 4
-1
votes
1 answer

Javascript Chain of promises in For Loop

I am using twilio platform ... and I am testing my code... but I dont understand what happen when I try to get a channel from channelDescriptor... I have this code: function processChannelPage(page) { var items =…
-1
votes
1 answer

Is there a way to merge two JS objects with the same keys?

if I have two objects: {a: 1, b: {c: 1}} and {d: 1, b: {e: 2}} Is there an easy way to merge the two nondestructively to create the following object? {a: 1, d: 1, b: {c: 1, e: 2}}
fox
  • 15,428
  • 20
  • 55
  • 85
-1
votes
1 answer

Delete and add attributes with array.map and the spread operator

I'm trying to mangle data returned from an api. I've got an array of objects returned. I want to delete the password field and then add a couple of additional fields. I'd like to use the spread operator but my process feels a bit…
Aidan Ewen
  • 13,049
  • 8
  • 63
  • 88
-1
votes
1 answer

How use connect in react redux

What is preset for webpack to handel connect decorate I tried to run webpack but nothing happened /* connect(store) class App extends React.Component{ } */
-1
votes
1 answer

ES6 opposite of includes logic

in order to remove objects from array i can find the objects i want to remove using the following piece of code: this.data = this.data.filter(item => this.multipleSelectedIds.includes(item.id)) but than what happens is i assign to the this.data…
yariv bar
  • 936
  • 3
  • 20
  • 39
-1
votes
1 answer

Babel setup on ES7

I have been upgrading my project to use ES7. I have changed some codes, made use of classes. But there is a problem. class Example { change = async (params) => { const job = await Some.job(); } } Everytime I wanted to debug it gives…
msharpp
  • 379
  • 1
  • 6
  • 20
-1
votes
4 answers

How do I access the nested properties of an array in Loopback?

here, res = Array of results retrieved res = [ Object, Object, Object... Object ] Each Object looks like this: Object{ "userId": "ab1ce", "groupId": "a1de2" } Now, the results has an array of objects like this, how do i access the userId…