Skip to content

Tag: ecmascript-6

Length of Array of Objects in JavaScript

I understand that finding the length of a JS object has been answered extensively here With one of the suggested solutions being Object.keys(myObj).length However, I’m struggling to find out how can I find the length of all properties contained on an array of objects. ie: Object.keys(users).length //3 G…

ES6 modules in Chrome

I’m trying to use ES6 modules in Chrome. From all the examples I’ve looked at the following seems to be the right way to do it, but when I run it in Chrome’s developer tools I get this error message… uncaught SyntaxError: Unexpected token { …highlighting the import statement in t…

ES6: fire React function

This is the code: What I am trying to do is to fire the updateNews code from render: But keep getting this error: Uncaught Error: this.updateNews is not a function Answer You were not calling the functuion Note: You do need to bind because you use arrow function.

Displaying images from fetch API call Node/React

Im trying display images im fetching from API btw url is defined Gallery.js with or without the regex /[blob:]{5}/gi it is only displaying the alt prop and not the image. The image is received and the get call is successful but the objectURL url is not working. Any help? Answer const {image} = this.props.phot…