0% found this document useful (0 votes)
3 views2 pages

JavaScript String Manipulation Functions

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

JavaScript String Manipulation Functions

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Write a JavaScript function to split a string and convert it into an array of words.

Test Data :
[Link](string_to_array("Chitra devi"));
["Chitra", "Devi"]

Write a JavaScript function to hide email addresses to protect from unauthorized


user.

Test Data:
[Link](protect_email("robin_singh@[Link]"));
"robin...@[Link]"

Get the position of c in the string txt.

let txt = "JavaScript is client side scripting Language";

let pos = txt. ;

Implement the slice method for returning the word “apples”.

let txt = "I eat apples the whole day";

let x = [Link]( , );

Implement the correct String method for replacing the word “Hello” with the
word “Hi”.

let txt = "Hello World";

txt = txt. ("Hello", "Hi");

Convert the txt value to uppercase.

let txt = "Hello World";

txt = ;
Convert the txt value to lowercase.

let txt = "Hello World";

txt = ;

Write a JavaScript function to capitalize each word in the string.

Test Data:
[Link](capitalizeWords('js string exercises'));
"JS STRING EXERCISES"

Write a JavaScript function to remove non-word characters.

Test Data :
[Link](remove_non_word('PHP ~!@#$%^&*()+`-={}[]|\\:";\'/?><.,
MySQL'));
"PHP - MySQL"

Write a JavaScript program to check if a given string contains alphanumeric


characters that are palindromes regardless of special characters and letter
case.
A palindrome is a word, number, phrase, or other sequence of symbols that
reads the same backwards as forwards, such as the words madam or racecar,
the date/time stamps 11/11/11 11:11 and 02/02/2020, and the sentence: "A
man, a plan, a canal - Panama". The 19-letter Finnish word saippuakivikauppias
(a soapstone vendor), is the longest single-word palindrome in everyday use,
while the 12-letter term tattarrattat (from James Joyce in Ulysses) is the longest
in English.
Test Data :
('$22_|1372^2731|_22') -> true
('12%^&2') -> false
('234%$$%432') -> true
(1234) -> "It must be string"
('aba%$aba') -> true
('Aba%$aba') -> true

You might also like