Write a javaScript function to capitalize the first character of the string. For example:
allenacademy
//output:
Allenacademy
Write a javaScript function to insert a string within a string at a particular position. For example:
We are learning exercises.
//now insert the word JavaScript at 14 position so output will be :
We are learning JavaScript exercises.
Write a JavaScript function to count the occurrence of a substring in a string.
"My name is allen academy and my friend name is Arun Kumar."
//find count of 'is' in this word is 2.
Ask user below questions:
- What is your name?
- What is your mobile number?
- What is your account number?
- What is your atm card number?
- What is your aadhar number?
Now do below tasks:
- Mask last 3 digits of the mobile number.
- Mask middle of 5 numbers of the account.
- Mask last 8 digit of atm card number.
- Mask starting 4 digits and last 4 digits of aadhar number.
Print below pattern using repeat function:
$
$$$
$$$$$
$$$$$$$
$$$$$$$$$
$$$$$$$$$$$
Ask below questions :
- What is your name?
- What is your birth year?
- What is your address ?
- What is your country code?
- What is your mobile number?
Now using string template literal syntax show below output based on your answer:
My name is Sajid Khan. I was born in 1993 and my current age is 30 years. My address is Jhotwara, Jaipur and my mobile number is +91956546565456
.
Divide a string in two part. Now in right side part of string add "Hello" in the end. In left side of the string add "World" in starting. For example:
let str = "Allen Academy"
//output:
Allen Hello World Academy
Guessing Game. Ask user what character is present at particular index in a word. If user guess is right then show him Congrulations message otherwise show Sorry message. For example:
Allen Academy
What is the character you are guessing? A
What is the index? 3
Sorry
Print pattern using repeat function:
***********
*********
*******
*****
***
*
Print below series using repeat function:
1 224 3339 44412 555520