Write a JavaScript program to check whether a string "Code" presents at 5th (index 4) position in a given string, if "Code" presents in the string return the string without "Code" otherwise return the original one.
Write a JavaScript program to capitalize the first letter of each word of a given string.
Example string : 'the quick brown fox'
Expected Output : 'The Quick Brown Fox'
Write a JavaScript program to check whether all the digits in a given number are the same or not.
Write a JavaScript function that reverse a number.
Write a JavaScript function to extract unique characters from a string.
Example string : "thequickbrownfoxjumpsoverthelazydog"
Expected Output : "thequickbrownfxjmpsvlazydg"
Write a JavaScript function to chop a string into chunks of a given length. Test Data :
console.log(string_chop('w3resource'));
console.log(string_chop('w3resource',2));
console.log(string_chop('w3resource',3));
["w3resource"]
["w3", "re", "so", "ur", "ce"]
["w3r", "eso", "urc", "e"]
Write a JavaScript function to find a word within a string. Test Data :
console.log(search_word('The quick brown fox', 'fox'));
console.log(search_word('aa, bb, cc, dd, aa', 'aa'));
Output :
"'fox' was found 1 times."
"'aa' was found 2 times."
Create an array of numbers. Now filter out all the numbers from the array where number is in between 30-50. After filtering the numbers, add 20 to each number and finally print the sum of all numbers using reduce function.
Convert below array:
[[1,2], [3,4], [5,6], [7,8], [9,10]]
to
[3,7,11,15,19]
Print below pattern:
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5