Question
Here is my code: //Declaring variables and prompting let word = prompt(Please enter a word? ); var word_array = word.split(); var rev_word = word_array.reverse(); //Reversing
Here is my code:
//Declaring variables and prompting let word = prompt("Please enter a word? "); var word_array = word.split(""); var rev_word = word_array.reverse(); //Reversing array var rev_word = rev_word.join(""); //Converting Array back to string console.log("Reversed Word is: " + rev_word); //Replacing every 2nd character word_array.reverse(); for (var i = 0; i < word_array.length; i++) { if (i % 2 == 1) { word_array[i] = "!"; } } var new_word = word_array.join(""); console.log("New Word: " + new_word);
Lecturers review: You still need to complete 2 requirements for your wordManip task. Every 6th letter must be uppercase. For this you can use a for loop and the toUpperCase() function. An array of the ASCII codes - for this you could look into using the charCodeAt() function.
Please help fix according to lecturers comments
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started