Skip to content

Latest commit

 

History

History
121 lines (81 loc) · 2.26 KB

11-basic-test-exercise.md

File metadata and controls

121 lines (81 loc) · 2.26 KB

Question 1

Write a javaScript function to capitalize the first character of the string. For example:

allenacademy

//output:
Allenacademy

Question 2

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.

Question 3

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.

Question 4

Ask user below questions:

  1. What is your name?
  2. What is your mobile number?
  3. What is your account number?
  4. What is your atm card number?
  5. What is your aadhar number?

Now do below tasks:

  1. Mask last 3 digits of the mobile number.
  2. Mask middle of 5 numbers of the account.
  3. Mask last 8 digit of atm card number.
  4. Mask starting 4 digits and last 4 digits of aadhar number.

Question 5

Print below pattern using repeat function:

     $
    $$$
   $$$$$
  $$$$$$$
 $$$$$$$$$
$$$$$$$$$$$

Question 6

Ask below questions :

  1. What is your name?
  2. What is your birth year?
  3. What is your address ?
  4. What is your country code?
  5. 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.

Question 7

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

Question 8

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

Question 9

Print pattern using repeat function:

***********
 *********
  *******
   *****
    ***
     *

Question 10

Print below series using repeat function:

1 224 3339 44412 555520