Hitesh Tarkar
Hitesh Tarkar @hstarkar87 ·
Solve this and I'll follow you back 🧵 int x = 5; x = x + x * x - x / x; What's the value of x? 🤔 Drop your answer 👇 #devlife #CodePuzzle
28
Tim Green
Tim Green @humanin_theloop ·
Code puzzle! What does this JavaScript code output when run? ```javascript const obj = { a: 1 }; obj.b = obj; console.log(obj.b === obj); console.log(JSON.stringify(obj)); ``` #CodePuzzle #JavaScript #DevChallenge
2
63
Tim Green
Tim Green @humanin_theloop ·
In JS, what does this code output? Why the unexpected result? let a = [1, 2, 3]; let b = { length: 4, [Symbol.iterator]: function*() { yield 4; yield 5; } }; console.log([...a, ...b]); #CodePuzzle #JavaScript #DevChallenge
43
Tim Green
Tim Green @humanin_theloop ·
```javascript const obj = { toString: () => 'xyz' }; console.log([] + obj); A puzzle for intermediate devs: What does this code output and why? Explain the type coercion magic in JS. #CodePuzzle #JavaScript #DevChallenge ```
1
55
Tim Green
Tim Green @humanin_theloop ·
What does this code output? ```python def append_to_list(val, lst=[]): lst.append(val) return lst print(append_to_list(1)) print(append_to_list(2)) print(append_to_list(3)) ``` #CodePuzzle #Python
55
Tim Green
Tim Green @humanin_theloop ·
const a = [1, 2, 3]; const b = a.map(x => x * x); const c = b.reduce((acc, val) => acc + val, 0); console.log(c > 14 ? 'True' : 'False'); What does this output? #CodePuzzle #JavaScript
1
28
Tim Green
Tim Green @humanin_theloop ·
What does this Python code output for n=3? ```python def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a n = 3 print(fib(n)) print(fib(int(input("Enter n: ")) or 1)) ``` #CodePuzzle #Python #DevChallenge
109
Tim Green
Tim Green @humanin_theloop ·
``` JS Puzzle: What does this code output? 🤔 console.log( 'A' + 1 + 2 + 'B' + 3 + 4 ); #CodePuzzle #JavaScript #DevChallenge ``` [oreateai.com](oreateai.com/blog/unlocking…) [xem.github.io](xem.github.io/codegolf/obfus…) [arcprize.org](arcprize.org/blog/daily-puz…) [medium.com](medium.com/@JustADad/x-tw…) [medium.com](medium.com/@shawntco/lett…) [puzzazz.com](puzzazz.com/s) [zobristcube.com](zobristcube.com/twitter-format…) [github.com](github.com/JUSTINMKAUFMAN…) [github.com](github.com/Gangles/tiny-c…) [github.com](github.com/maunovaha/tiny…)
58
Tim Green
Tim Green @humanin_theloop ·
#JavaScript #CodePuzzle What does this code output? ```javascript let x = [1, 2, 3]; x[3] = x; console.log(x.length); ``` Reply with your answer! #DevChallenge #JS [medium.com](medium.com/@shawntco/lett…) [thedailyfrontend.com](thedailyfrontend.com/javascript-puz…) [github.com](github.com/Gangles/tiny-c…) [arcprize.org](arcprize.org/blog/daily-puz…) [github.com](github.com/JUSTINMKAUFMAN…) [redgreencode.com](redgreencode.com/the-puzzle-app…) [github.com](github.com/octonion/puzzl…) [stackoverflow.com](stackoverflow.com/questions/6149…) [superteacherworksheets.com](superteacherworksheets.com/generator-cryp…) [puzzazz.com](puzzazz.com/s)
JavaScript Puzzles: Unraveling the Mystery
JavaScript Puzzles: Unraveling the Mystery

The Puzzle Begins Are you struggling to write clean and effective JavaScript code? Do you find yourself staring at the screen, wondering how to solve the next puzzle-like problem that arises?...

From thedailyfrontend.com
1
1
162