Skip to content

Tag: ecmascript-6

Create object from array

I want to create an object from a list inside an array. I have an array which is dynamic and supposed to look like this: var dynamicArray = [“2007”, “2008”, “2009”, “2010”]; And I want to make an object like this with some JavaScript ES6: Don’t worry about…

update array of object without mutation

I’m following a react tutorial but I’m lost. I don’t understand starting line 9. so I tried to make a little miarature https://jsbin.com/sifihocija/2/edit?js,console but failed to produce the result that the author did, what’s wrong? Answer Issue is in this line: const index = list.fin…

What is the purpose of the script scope?

When inspecting scopes of a function in the DevTools console I noticed a “script” scope. After a bit of research it seems to be created for let and const variables. Scopes of a function in a script without const or let variables: Scopes of a function in a script with a let variable: Yet the follow…

ES6 deep nested object destructuring

I have an object called this.props which contains statement contains I would like to extract statement object and the isConfirmed property in the same line using es6 destructuring I’ve tried which I get an error when I do let a = isConfirmed, b = statement Answer I would like to extract statement object…