JavaScript: Create new string with first 3 characters are in lower case
JavaScript Basic: Exercise-37 with Solution
Modify String Based on Length (First 3 Lowercase/Uppercase)
Write a JavaScript program to produce a new string that has the first 3 characters in lower case from a given string. If the string length is less than 3 convert all the characters to upper case.
The program converts the first three characters of a given string to lowercase if the string length is 3 or more. If the string length is less than 3, it converts the entire string to uppercase.
Visual Presentation:

Sample Solution:
JavaScript Code:
Output:
python PY javAScript
Live Demo:
Flowchart:

ES6 Version:
For more Practice: Solve these Related Problems:
- Write a JavaScript program that converts the first three characters of a string to lowercase if the string length is 3 or more, otherwise to uppercase.
- Write a JavaScript program that changes the first three characters of a string to lowercase and the rest to uppercase if the string length exceeds 3.
- Write a JavaScript program that modifies a string by altering the case of the first three characters and appending a suffix indicating the change.
Go to:
PREV : Check if Last Digit of Three Integers is Same.
NEXT : Evaluate Grades Based on Total Marks and Final Exam.
Improve this sample solution and post your code through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.