Questions tagged [ecmascript-2017]

Use this tag for questions about features finalized in ECMAScript 2017. Do *not* use this tag if the code in question merely *uses* one of the features, *unless* the feature is cause of the problem.

Proposals finalized in 2017 include:

387 questions
0
votes
2 answers

environment setup for ReactJS

currently i am doing environment setup for react.js with npm (babel, webpack and etc.) and i now i am filling webpack.config.js file and tutorial that i am following has next code : module: { rules: [ { test: /\.jsx?$/, …
ilia
  • 339
  • 8
  • 23
0
votes
4 answers

How does async-await work in JavaScript? Does making a function async make it asynchronous?

Does making a function async make it asynchronous? I started using async-await in place of a promise chain. I did something like async function f(){ let r = await first(); let d = await sec(r); return d; } On calling this function I was…
jyotibisht
  • 80
  • 10
0
votes
0 answers

HTML include script with jsx, es2017 tags and other tags

I have the following Javascript (JSX, es2017, and others) that works fine when included on a page, but when I fetch the content from a url in a src tag, it's no longer functional. How can I include the following when the source is from another…
Alexander Kleinhans
  • 5,950
  • 10
  • 55
  • 111
0
votes
2 answers

Entity Component System with Component prototypes

I have an Entity Component System written in ES7. I would like to minimize its memory usage. Because lots of those entities in the system are very similar, they share the references to components that are 'same'. I call them component…
Libor Max
  • 1
  • 1
0
votes
2 answers

Javascript loaded by an Ajax call doesn't execute?

I´m trying to implement html code with Ajax-get into my temp-page. This works as it should, only the javascript isn´t executed as I expected. If I load the code independently in the browser, then the javascript executes as expected. If it's…
0
votes
1 answer

Casting strings to enum in TypeScript

I've ran into a little issue when working with enums in TypeScript. My scenario is this: I have defined a string enum containing allowed values I have defined a method that accepts any incoming value (of string type), and have to cast it to the…
Terry
  • 63,248
  • 15
  • 96
  • 118
0
votes
2 answers

How to play next audio track when current ends in HTML5?

The code below is supposed to play a single MP3 file, the idea is to skip to a specific part of the track and then start to play from there. Although the cursor moves to the correct position in the mp3, it doesn't play after clicking on Start from…
0
votes
1 answer

problem with filter in NodeJS and MongoDB

Build an application with MongoDB and NodeJS as backend-server. Fetched some companies details from database according to their category id, the problem is that the information is not displayed on both postman and ionic project, when called this…
0
votes
0 answers

Why a rejected parameter of a promise works outside of its scope?

See, a promise have two parameters resolved and rejected. So by calling then, you are passing it 2 parameters. router.route('/issue/add').post((req,res) => { let issue= new Issue(req.body); issue.save().then((issue) => { …
0
votes
3 answers

How to get a particular property of one JSON using one common property with other JSON objects?

I am new to react.js and facing problems while performing the below task. When running following the code, it shows setState can't be used and the app breaks. I have these two objects, obj2 generates a table 3 columns. I need to make each cell of…
Learner
  • 157
  • 1
  • 7
0
votes
1 answer

Convert string to enum with generics

How can I convert a string to Enum using generics in TypeScript? export function getMethodEnum(actionStr: string): T { return actionStr as T; // does not work } export enum ActionEnum { Unknown = 0, Sleep = 1, Run } let action:…
wonea
  • 4,783
  • 17
  • 86
  • 139
0
votes
3 answers

How to check for email duplication from array in JavaScript?

Have two emails and trying to check if it matches anything in my data array which is an array of emails. Thought the below would return true or false but it seems to be not working: const email1 = test.emailAddress.value; const email2 =…
eman
  • 253
  • 2
  • 12
0
votes
1 answer

Arrrow functions in JavaScript ES6 - with and without curly braces

Like to ask about the differences in ES6 in function syntax - with and without curly braces. both functions are working: function with a curly braces: const function = () => {some code;}; same function without curly braces: const function = ()…
Ori
  • 160
  • 1
  • 10
0
votes
2 answers

How to execute multiple async functions depending on each other?

it seems I understand the behavior of async/ await, but now-now i am deeply stuck with my problem and cant solve it. I am trying to create weather app and so I need to request the latitude and longitude first, then getting that info to send a…
Norayr Ghukasyan
  • 1,298
  • 1
  • 14
  • 28
0
votes
1 answer

React load value and allow user to alter value within component

I'm new to React (16.4.2), and I'm trying to understand the way it works. I don't want to complicate things with redux; I just want to know about the core react library. I have an application, and (eventually down the children chain) there is an…
KellyTheDev
  • 891
  • 2
  • 12
  • 31