Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
-1 votes
3 answers
109 views

I've received a Cypress error suggesting that multiple elements contain the searched value, so it cannot recognize the requested one. Here is the Cypress script I've used for testing: it('Check all ...
0 votes
1 answer
46 views

snippet 1 -> output is "b" if (true) { x = "b"; function x() {} } console.log(x); //b snippet 2 -> output is ƒ x() {} if (true) { function x() {} x = "b";...
-2 votes
2 answers
137 views

As demonstrated in the below examples, I used the function keyword to declare a function that will generate a random integer number within a range, and I also used a const keyword to declare another ...
1 vote
0 answers
43 views

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 ...
0 votes
1 answer
117 views

Here are two similiar codes except for the "use strict" part "use strict" { function a() { return 1; } } function a() { return 2; } ...
0 votes
2 answers
161 views

I have two questions about hoisting: The way function declarations are hoisted is that they go to the very top, even above variable declarations, to my understanding. If we have this code: function fn(...
2 votes
0 answers
58 views

Here is the fact in Head first js, when the browser evaluates a function declaration, it creates a function as well as a variable with the same name as the function, and stores the function reference ...
0 votes
4 answers
349 views

I implemented a new feature to our CRM and everything works as it should on Safari (macOS), but it throws Uncaught TypeError: X is not a function on every other browser we tested it on (Chrome, ...
1 vote
0 answers
59 views

I have a doubt regarding how the function declaration are invoked in JavaScript. I have read somewhere that function declaration can be accessed anywhere within the function it was declared on. Lets ...
0 votes
2 answers
227 views

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"); } ...
0 votes
2 answers
66 views

These 2 statements seem to do the same thing. const handleClick = () => alert('foo'); and function handleClick() { alert('foo'); } Are they identical and just syntactically different? The ...
2 votes
1 answer
1k views

In a javascript file, when I declare a function using function keyword, I can placed my function after my caller function, something like // test.js function myCaller() { foo('hello world'); ...
0 votes
1 answer
81 views

I have a module pattern with a variable setting the currentPlayer to 1. I use a function expression to toggle that variable const game = (() => { let currentPlayer = 1; const ...
1 vote
1 answer
62 views

Assuming a function declaration is a statement where the function keyword is the first word of the statement, e.g.: function() { console.log("foo") }; Assuming that a function expression is e.g. ...
0 votes
1 answer
4k views

According to hoisting definition: Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution Why do function ...

15 30 50 per page
1
2 3 4

AltStyle によって変換されたページ (->オリジナル) /