Array Based Questions:-
- Find the largest element in an array.
- Find the smallest element in an array.
- Reverse an array without using extra array.
- Check whether an array is sorted or not.
- Count total even and odd numbers in an array.
- Find the sum of all elements of an array.
- Find the index of a given element in an array.
- Count frequency of each element in an array.
- Remove duplicate elements from a sorted array.
- unique array
- (use indexOf and splice)
- Move all zero elements to the end of the array.
Question: Function Expression & Hoisting
console.log(add(10, 20));
var add = function(a, b) {
return a + b;
};
Tasks:
- Predict the output.
- Explain why this output occurs.
- Convert it into a working version without changing function expression