Skip to main content

Questions tagged [arrow-functions]

Questions about the compact function syntax in ECMAScript2015 (ES6) called "arrow functions" because of their use of "=>".

arrow-functions
0 votes
1 answer
50 views

What forms a scope in javascript? [duplicate]

While reading about 'this' keyword and arrow function, I read: that arrow functions binds to whatever execution context the surrounding scope has. I have attached a simple code example below. When I ...
aarshin gupta's user avatar
0 votes
1 answer
36 views

How can I return data from preloaded Electron script?

I have built a function in preload.js that gets a JSON file sent from main.js. renderer.js loads it fine, but I can't seem to give the data to another variable outside of the arrow function. main.js ...
liminalFrog's user avatar
1 vote
0 answers
62 views

Getting and Setting custom Json attribute in Laravel 11

I have a Model called Service which migration is as follows: Schema::create( 'services', function( Blueprint $table ){ $table->id(); $table->json( 'data' ); $table->dateTime( '...
Tales's user avatar
  • 1,881
0 votes
1 answer
33 views

How do you switch one image to another using JavaScript?

I have been looking into different ways to use JS to switch from one image to another. I tried using classList.toggle and now eventListener method, which I thought will work just fine but the button ...
user24807062's user avatar
1 vote
0 answers
64 views

Why use the (this) for a method that already has context, and how to use arrow syntax [duplicate]

I have an issue. I am learning JavaScript coding from a book I got and it is going pretty well. I went from not knowing anything at all to knowing how to store, modify and use data in about a week, ...
Mgonzalez08's user avatar
0 votes
1 answer
72 views

graphviz arrow, node, table - I'm looking for a solution to avoid a double arrow?

I generate a code for graphviz. This network plan always contains 2 arrows for there and back directions. Unfortunately, 2 separate arrows are displayed in the example - but I don't want that... ...
Tim's user avatar
  • 1
0 votes
1 answer
42 views

Is it possible to change variable value inside this function? [duplicate]

Is it possible to change the value of p inside the mf function via the call to up function passing it the p variable? Theoretically it should be possible because javascript passes references of ...
roy's user avatar
  • 13
1 vote
4 answers
78 views

flatMap with one line of arrow function confusion

The first arrow function in flatMap does not get me what I need, the second arrow function does. I need to turn data into the flat name array ['John', 'Jane', 'Bob'] const data = [ [{ name: 'John',...
Qiulang's user avatar
  • 11.6k
0 votes
0 answers
22 views

Can't change a variable inside onSnapshot method [duplicate]

So my intention is to fetch the data from Firestore with an onSnapshot method (as it automatically updates when a change occurs) and then write it inside a variable. I tried it with this: let ...
Ejcz's user avatar
  • 1
-2 votes
1 answer
55 views

Calling a function in Arrow Function

I just wanted to know how does this work, if I have an onChange() onChange={() => input()} The above code immediately executes the input function when onChange() is triggered. But what about this, ...
Piyush Pal's user avatar
0 votes
0 answers
18 views

What is the difference between `function () {}` and `() => {}` in JavaScript?

I am trying to add a method to the Person constructor function but keep getting an output of "Hello undefined" function Person(name, age) { this.name = name; this.age = ...
Abraham Abah's user avatar
0 votes
2 answers
60 views

Providing seperate ref attribute to multiple element in reacJS

I am trying to build a simple to-do list where each task can be edited by clicking on edit button which shows a previously hidden text field in which user can enter new name for the current task, for ...
9ust00learn's user avatar
-2 votes
2 answers
66 views

Higher Order Component in react js

The wrapper function takes two inputs, one is the component and the other is the class name. My question is, why didn't we directly use jsx codes after return? Why did we put an arrow function after ...
Fatemeh Hp's user avatar
0 votes
0 answers
65 views

arrow function & setTimeout scope [duplicate]

I'm following this tut on js: https://www.youtube.com/watch?v=ajTvmGxWQF8&list=PL1PqvM2UQiMoGNTaxFMSK2cih633lpFKP&index=8 and in the part where he explains why not to use setTimeout with arrow ...
Luis Aguiar's user avatar
1 vote
0 answers
50 views

Arrow function isn't getting the value of a object property [duplicate]

I'm trying to use a arrow function inside of a JS object, but it isn't getting the value of a object property. However, if I use a traditional function expression, it works properly. Here's an example,...
Felipe's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
103