V.Vidhya Logo

V.Vidhya

String Methods


Q1.

Take password from user as input using prompt.

Now generally in practice, spaces aren’t allowed in password, so remove unnecessary spaces from start and end, then store it, then print it for testing.


Q2.

Take email from user as input using prompt.

Now generally in practice, we prefer email to be in all small case, so convert it into lowercase, also remove unnecessary spaces from start & end for safety (User might have added them by mistake), then store it, at last print it for testing.


Q3.

For the string:

let str = “LetslearnJS”;

predict the output of the following operations:

You have to predict the output yourself without running/executing the code.


Q4.

Separate the “Lets” part in the given string "LetsLearnJS" & replace 't' with 's' in it.

Expected Output:

// LetsLearnJS --> Lets -->

Less

Prev Post
Conditional Statements Cumulative (with Alert & Prompt)
Next Post
Array Basic