JavaScript Daily Challenge โ Day 11 ๐
- Reverse a number using pure math logic.
- Works for both positive and negative numbers.
Example: -789 โ -987
#JavaScript#CodeDaily#JSInterview#Day11#LearnJS
ALT Image showing JavaScript code to reverse a number using math logic. The function checks if the number is negative, converts it to absolute value, then uses a while loop to extract digits using modulo and rebuild the reversed number. It returns the reversed number with original sign. Examples show 123 becomes 321 and -789 becomes -987.
JavaScript Daily Challenge โ Day 5 ( 1 )๐
Find the factorial of a number step by step.
Handles negative values, non-integers, and uses a clean for loop.
Would you solve it using recursion instead? ๐ค
#JavaScript#JSInterview#CodeDaily#Day5#LearnJS
ALT Image showing JavaScript code that calculates the factorial of a number using a for loop. The function checks for negative numbers and non-integer values, handles the base case, and returns the factorial result. Example shows calling the function with 5 and outputting 120.
JavaScript Daily Challenge โ Day 1 ๐
3 different ways to create an array from 1 to 100. Same output, different approaches.
Is there a cleaner or more modern JS way to do this?
Drop your thoughts !!
#JavaScript#JSInterview#LearnJS#Day1#CodeDaily
ALT Image showing JavaScript code with three different methods to create an array containing numbers from 1 to 100. Method 1 uses the push() method, Method 2 assigns values using an index variable, and Method 3 uses the array length property to append values. The image compares different approaches that produce the same output.
const arr = [1, 2, 3];
arr[10] = 99;
Whatโs the length of arr now?
And what's happening under the hood?
Are those โmissingโ indexes stored?
Whatโs the difference between undefined and a โholeโ?
How does V8 optimize this?
#JavaScript#DevTrivia#V8#Internals#JSInterview
Q) Can you explain the difference between 'let,' 'const,' and 'var' in JavaScript?
'let' allows variable reassignment, while 'const' is for constants. 'var' is function-scoped and doesn't support block scope like 'let' and 'const'.
#JSInterview#WebDevQA
follow up on our discussion with trees, as they come up a lot in web development:
Trees are commonly represented in deeply nested objects, like the one in the previous #jsinterview.
(In fact, the tree data was copied from an example of the Tree component from @AntDesignUI)
#jsinterview
Imagine you have a tree component. And you have the data used to render it.
Some of the tree nodes are disabled.
Can you write a function to find all the disabled nodes?
#jsinterview
Imagine you have a tree component. And you have the data used to render it.
Some of the tree nodes are disabled.
Can you write a function to find all the disabled nodes?