Search: #JavaScriptRiddle

Include

Only show posts containing:

Exclude

Hide posts containing:

Time range
-
Minimum likes
🤖 JavaScript Conundrum! 🧩 To all the coding pros out there, here’s a quick test! What does typeof null return in JavaScript? A) ‘null’ B) ‘object’ C) ‘undefined’ Drop your guess in the comments! 📥 No Googling ! 🔍 #JavaScriptRiddle #WebDevTest #KnowYourCode #html #css #javascript
155
#JavaScript #Riddle what's the output of this code: class X { v = 1; f() { return this.v } g = () => this.v } const x = new X console.log(x.g()) console.log(x.f()) const f = x.f const g = x.g console.log(g()) console.log(f()) #JavaScriptRiddle
6
5
2,118
#JavaScript #Riddle - haven't had one in a while 🙂 What's the exact output: const x = {}; x.b = 1; x[2] = 2; x[1] = 3; x[Symbol()] = 4; x.a = 5; console.log(...Object.values(x)); // ? #JavaScriptRiddle
3
4
Presented as 6 methods but it's really only 2. Anyway, cool JavaScript riddle but don't ask this in a job interview #JavaScriptRiddle javascript.plainenglish.io/i… – at Israel
1
2
Haven't done one in a while #JavaScriptRiddle try { switch (true) { case 1 < 2: console.log('hello'); case 2 > 3: console.log('world'); } } catch { console.log('bye'); } What's the output? #JavaScript #Riddle
5
1
1
14
Replying to @MichalPorag
First, if you enjoy such things, checkout my #javascriptriddle tweets. Also, since const and let are block-scoped, I hardly use IIFEs anymore.
1
3
#JavaScript #Riddle without checking, is this legal and if so what's the value of x: const x = {...[]} And is this legal and if so what's the value of y: const y = [...{}] #JavaScriptRiddle
4
5
#JavaScript #Riddle: what's the output? function a() {} function b(x) {} function c(x = 1) {} function d(...x) {} console.log(a.length, b.length, c.length, d.length) #JavaScriptRiddle
6
1
2
Another #JavaScript #Riddle about the spread operator: let x; let y = {...x}; let z = [...x]; What are the values of x, y and z? #JavaScriptRiddle
3
2
3
#JavaScript #Riddle: const a = [1,2] const x = {v:1} const b = [...a] const y = {...x} console.log(...b) console.log(...y) Is this correct JS? What's the output? #JavaScriptRiddle
5
2
3
Think you know #JavaScript symbols? How many hellos will this display: const s = Symbol() const x = {[s]:'hello'} console.log(x[s]) for (v in x) console.log(v) const y = {...x} console.log(y[s]) console.log(Object.values(y)[0]) #JavaScriptRiddle
3
1
4
#riddle: this is now valid #javascript const a = 1_000; // a is 1000 But what about: const b = 1,000; Is this valid? And if so, what's the value of b? #JavaScriptRiddle
4
1
5
#JavaScript riddle: what's the value of x? function f() { try { return 1; } finally { return 2; } } const x = f() #JavaScriptRiddle #CodingNewbie #100DaysOfCode
6
9
1
18
Thanks for sharing Dan :) #JavaScript #JavaScriptRiddle
Replying to @debug_mode @getify
To all those he enjoyed figuring out and understanding how and why #JavaScript behaves this way, you may also enjoy the JS riddles I occasionally post. Just check out the hashtag #JavaScriptRiddle Scroll down and see how many you can solve ☺️
2
Replying to @debug_mode @getify
To all those he enjoyed figuring out and understanding how and why #JavaScript behaves this way, you may also enjoy the JS riddles I occasionally post. Just check out the hashtag #JavaScriptRiddle Scroll down and see how many you can solve ☺️
1
2
#JavaScript #riddle: what's the output and why? function f() { console.log(g); { function g() {} } } f(); #JavaScriptRiddle
34%Uncaught ReferenceError
45%undefined
21%f g() {}
97 votes • Final results
9
4
4
#JavaScript riddle - what's the output: async function* g() { yield 1; yield 2; } async function f() { for await (const v of g()) console.log(v); console.log(3); } f(); f(); console.log(4); #JavaScriptRiddle
6
7
1
4
Start your #JavaScript programming day with a bit of fun and learning: my @JSCampRo talk "JavaScript Riddles For Fun And Profit" youtube.com/watch?v=uaGLxAnR… #JavaScriptRiddle
2
3
Next month at @JSCampRo I'll be giving #JavaScript Riddles talk. Here's an example - is this valid code, and if so, what's the output: const a="b" const {[a]:b}={b:[a]} console.log(b) // ? What fun we will have! #JavaScriptRiddle
2
2
1
3
Silly #JavaScript #Riddle: what's the output of the following code? var a = [3,2].map(v=>[v]) [1,0].forEach(v=>console.log(v,a)) Running in the console is cheating 😉 #JavaScriptRiddle
7
3
4
12