Skip to main content
1 vote
0 answers
40 views

JavaScript Immediately Invoked Function - Distinguishing Between JavaScript Function Expressions and Declarations [duplicate]

In my journey of learning JavaScript, I encountered my first practical use case for an Immediately Invoked Function Expression (IIFE). However, I'm struggling to understand the distinction between a ...
alstorx's user avatar
  • 111
0 votes
2 answers
74 views

Function Expression vs Function Declaration in Javascript Decorators

I have a problem understanding how different ways to create a function are affecting decorators. I am trying to create a decorator that will allow me to count how may times function was called: ...
Иван Бельков's user avatar
0 votes
1 answer
27 views

On the fly function expression doesn't throw error when triggering with first class [duplicate]

I am learning Javascript and I came across these concepts of function expressions & first class functions. While I do understand their definition, I am unable to understand why my code behaves the ...
M Navneet Krishna's user avatar
-1 votes
2 answers
161 views

How to write Java Script arrow functions in regular function syntax?

I need help to rewrite some arrow functions to regular functions but right now my brain is totally stucked, I have some example code here from a rock paper scissors game I got from kyle, how would it ...
Peterman's user avatar
-1 votes
1 answer
597 views

How can I validate email,firstname and lastname?

I try to validate firstname,lastname and email taken by user and return true if its valid or return false if it is not valid then ask the user to enter again as long as it is not valid.By writing a ...
Alex's user avatar
  • 13
0 votes
1 answer
546 views

how to conditionally include or exclude statements from function expression

i have 2 different javascript environments and want to create a library usable on both. to do that i want to use higher order functions to generate my functions, like so try { Maptool.chat....
ether's user avatar
  • 1
0 votes
2 answers
218 views

JavaScript hoisting for function expression and function declaration [duplicate]

I am learning hoisting in JavaScript and practicing some examples. In an example I am confused of it's output. Here is the example code: var f = function(){ console.log("Expression"); } ...
Arjuman Sreashtho's user avatar
3 votes
2 answers
653 views

When we should use class expression in Javascript?

I have recently got to know that we do have class expressions too like function expressions in JS. I know some points about it(MDN) like: Class expressions may omit the class name ("binding ...
Apoorva Chikara's user avatar
0 votes
2 answers
70 views

How to convert an arrow function expression into an equivalent ordinary (old-style) function expression?

How do you convert the following arrow function expression to a regular one? rootRef.on('child_removed', snapshot => { console.log('Child(s) removed'); B4A.CallSub('onchild_removed',true,&...
lonecoder's user avatar
-2 votes
1 answer
471 views

How to create a function expression that returns an array?

(The challenge reads like this) Create a function expression named getNumberAr with no parameters The getNumberAr function should return an array of 5 numbers Call getNumberAr and store its result ...
johnny's user avatar
  • 1
0 votes
1 answer
625 views

Dart/Flutter arrow function expression confusion

I'm confused with arrow syntax in this Navigator implementation: Navigator.push( MaterialPageRoute( context, builder: (context) => aWidgetConstructor() ) ) From what I guess, the ...
Sang Trần Tiến's user avatar
1 vote
1 answer
63 views

Can You Implement Javascript Class Via Function Expression?

I was tackling this question in leet code: Implement the MapSum class: MapSum() Initializes the MapSum object. void insert(String key, int val) Inserts the key-val pair into the map. If the key ...
maddie's user avatar
  • 1,954
0 votes
1 answer
395 views

Is this an arrow function declaration? Is there such a thing?

I am looking into function expressions vs function declarations using arrow functions. I am thinking this is an arrow function expression: const johan = greeting = () => { console.log("Hi ...
Johan Berglund's user avatar
0 votes
3 answers
49 views

Difficulty Iterating Through Function Call - First Class Functions

The code I have provided executes properly, however as you will see it offers refreshments to each guest repeatedly before moving on to the next guest. I'm scratching my head as to how I can alter my ...
Lil' Big Boy's user avatar
1 vote
2 answers
203 views

What is the difference between 'let' and 'this' in JavaScript?

I'm learning JavaScript, coming from Ruby, have done some stuff in C as well. One example in my reading is: function letCounter() { let counter = 0; return () => ++counter; } and is compared ...
Aaron Parisi's user avatar

15 30 50 per page
1
2 3 4 5
7