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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!