WRITE A PROGRAM IN JAVASCRIPT TO ACEPT 10 NUMBERS FROM THE USER IN AN EMPTY ARRAY AND DISPLAY THE NUMBERS WHICH ARE MULTIPLE OF 5 ANO MULTIPLE OF > IN TWO SEPERATE ARRAYS ON THE BROWSER WINDOW
Answers
Answer:
WRITE A PROGRAM IN JAVASCRIPT TO ACEPT 10 NUMBERS FROM THE USER IN AN EMPTY ARRAY AND DISPLAY THE NUMBERS WHICH ARE MULTIPLE OF 5 ANO MULTIPLE OF > IN TWO SEPERATE ARRAYS ON THE BROWSER WINDOW
Explanation:
bro please mark me brainliest
Write a JavaScript function to check whether an `input` is an array or not. Go to the editor
Test Data :
console.log(is_array('w3resource'));
console.log(is_array([1, 2, 4, 0]));
false
true
Click me to see the solution
2. Write a JavaScript function to clone an array. Go to the editor
Test Data :
console.log(array_Clone([1, 2, 4, 0]));
console.log(array_Clone([1, 2, [4, 0]]));
[1, 2, 4, 0]
[1, 2, [4, 0]]
Click me to see the solution
3. Write a JavaScript function to get the first element of an array. Passing a parameter 'n' will return the first 'n' elements of the array. Go to the editor
Test Data :
console.log(first([7, 9, 0, -2]));
console.log(first([],3));
console.log(first([7, 9, 0, -2],3));
console.log(first([7, 9, 0, -2],6));
console.log(first([7, 9, 0, -2],-3));
Expected Output :
7
[]
[7, 9, 0]
[7, 9, 0, -2]
[]
Click me to see the solution
4. Write a JavaScript function to get the last element of an array. Passing a parameter 'n' will return the last 'n' elements of the array. Go to the editor
Test Data :
console.log(last([7, 9, 0, -2]));
console.log(last([7, 9, 0, -2],3));
console.log(last([7, 9, 0, -2],6));
Expected Output :
-2
[9, 0, -2]
[7, 9, 0, -2]
Click me to see the solution
5. Write a simple JavaScript program to join all elements of the following array into a string. Go to the editor
Sample array : myColor = ["Red", "Green", "White", "Black"];
Expected Output :
"Red,Green,White,Black"
"Red,Green,White,Black"
"Red+Green+White+Black"
Click me to see the solution
6. Write a JavaScript program which accept a number as input and insert dashes (-) between each two even numbers. For example if you accept 025468 the output should be 0-254-6-8. Go to the editor
Click me to see the solution
7. Write a JavaScript program to sort the items of an array. Go to the editor
Sample array : var arr1 = [ 3, 8, 7, 6, 5, -4, 3, 2, 1 ];
Sample Output : -4,-3,1,2,3,5,6,7,8
Click me to see the solution
8. Write a JavaScript program to find the most frequent item of an array. Go to the editor
Sample array : var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3];
Sample Output : a ( 5 times )
Click me to see the solution
9. Write a JavaScript program which accept a string as input and swap the case of each character. For example if you input 'The Quick Brown Fox' the output should be 'tHE qUICK bROWN fOX'. Go to the editor
Click me to see the solution
10. Write a JavaScript program which prints the elements of the following array. Go to the editor
Note : Use nested for loops.
Sample array : var a = [[1, 2, 1, 24], [8, 11, 9, 4], [7, 0, 7, 27], [7, 4, 28, 14], [3, 10, 26, 7]];
Sample Output :
"row 0"
" 1"
" 2"
" 1"
" 24"
"row 1"
------
------
Click me to see the solution
11. Write a JavaScript program to find the sum of squares of a numeric vector. Go to the editor
Click me to see the solution
12. Write a JavaScript program to compute the sum and product of an array of integers. Go to the editor
Click me to see the solution
13. Write a JavaScript program to add items in an blank array and display the items. Go to the editor
Sample Screen :
add elements in an blank array
Click me to see the solution
14. Write a JavaScript program to remove duplicate items from an array (ignore case sensitivity). Go to the editor
Click me to see the solution
15. We have the following arrays : Go to the editor
color = ["Blue ", "Green", "Red", "Orange", "Violet", "Indigo", "Yellow "];
o = ["th","st","nd","rd"]
Write a JavaScript program to display the colors in the following way :
"1st choice is Blue ."
"2nd choice is Green."
"3rd choice is Red."
- - - - - - - - - - - - -
Note : Use ordinal numbers to tell their position.
Click me to see the solution
16. Write a JavaScript program to find the leap years in a given range of years. Go to the editor
Click me to see the solution
17. Write a JavaScript program to shuffle an array. Go to the editor
Click me to see the solution