
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
327 Views
We are required to write a JavaScript function that takes in two numbers and returns their difference but without using the (-) signExampleFollowing is the code −const num1 = 56; const num = 78; const subtractWithoutMinus = (num1, num2) => { if(num2 === 0){ return num1; }; return subtractWithoutMinus(num1 ^ num2, (~num1 & num2)

AmitDiwan
201 Views
We are required to write a JavaScript function that takes in an array of literals containing all similar elements but one. Our function should return the unlike number.ExampleFollowing is the code −const arr = [2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]; // considering that the length ... Read More

AmitDiwan
531 Views
We are required to write a JavaScript function that takes in a number and returns the first prime number that appears after n.For example: If the number is 24, Then the output should be 29ExampleFollowing is the code −const num = 24; const isPrime = n => { if ... Read More

AmitDiwan
178 Views
An array of numbers is 100% shuffled if no two consecutive numbers appear together in the array (we only consider the ascending order case here). And it is 0% shuffled if pairs are of consecutive numbers.For an array of length n there will be n-1 pairs of elements (without distorting ... Read More

AmitDiwan
5K+ Views
We are required to write a JavaScript function that takes in a number n and returns a random string of length n containing no other than the 26 English lowercase alphabetsExampleLet us write the code for this function −const num = 8; const randomNameGenerator = num => { let ... Read More

AmitDiwan
459 Views
We are required to write a JavaScript function that takes in a number n as the only input.The function should first find the current day (using Date Object in JavaScript) and then the function should return the day n days from today.For example −If today is Monday and n = ... Read More

AmitDiwan
130 Views
We are required to write a JavaScript function that takes in an array of Number / String literals and returns another array of arrays. With each subarray containing exactly two elements, the nth element from start nth from last.For example −If the array is −const arr = [1, 2, 3, ... Read More

AmitDiwan
328 Views
The primorial of a number n is equal to the product of first n prime numbers.For example, if n = 4Then, the output primorial(n) is, 2*3*5*7 = 210We are required to write a JavaScript function that takes in a number and returns its primordial.ExampleFollowing is the code −const num = ... Read More

AmitDiwan
228 Views
We are required to write a JavaScript function that takes in an array that contains elements of different data types and the function should return a map representing the frequency of each data type.Let’s say the following is our array −const arr = [23, 'df', undefined, null, 12, { ... Read More

AmitDiwan
204 Views
We are required to write a JavaScript function that takes in two arrays of numbers.And the function should return true if the two arrays upon combining and shuffling can form a consecutive sequence, false otherwise.For example − If the arrays are −const arr1 = [4, 6, 2, 9, 3]; const ... Read More