
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Program to make vowels in string uppercase and change letters to next letter in alphabet (i.e. z->a) in JavaScript
We are required to write a JavaScript function that takes in a string as the only input.
The function should construct a new string based on the input string in which all the vowels should be uppercased and change each alphabet to the corresponding next alphabet.
For example − If the input string is −
const str = 'newString';
Therefore, the output for the above input should look like this −
const output = 'oExSusIoh';
Example
The code for this will be −
const str = 'newString'; const capitiliseAndMove = (str = '') => { let s = ''; s = str.replace(/[a−z]/g, function(c) { return 'aeiou'.indexOf(c) > −1 ? c.toUpperCase() : String.fromCharCode(Math.max(c.charCodeAt(0) % 122 + 1, 97)); }); return s; }; console.log(capitiliseAndMove(str));
Output
And the output in the console will be −
oExSusIoh
- Related Articles
- Make first letter of a string uppercase in JavaScript?
- Change every letter to next letter - JavaScript
- For the Hosts Locale how to convert a string to uppercase letters in JavaScript?
- Finding the immediate next character to a letter in string using JavaScript
- How to convert lowercase letters in string to uppercase in Python?
- How to test if a letter in a string is uppercase or lowercase using javascript?
- First uppercase letter in a string (Iterative and Recursive) in C++
- How to convert all uppercase letters in string to lowercase in Python?
- Convert number to alphabet letter JavaScript
- Swapping letter with succeeding alphabet in JavaScript
- How to shift each letter in the given string N places down in the alphabet in JavaScript?
- C# Program to count vowels in a string
- Java Program to count vowels in a string
- Write a C program to convert uppercase to lowercase letters without using string convert function
- Return Vowels in a string in JavaScript

Advertisements