Question: with java script: Find the position of the string ten within a sentence, without using the exact string directly (this can be avoided in many
with java script:
Find the position of the string "ten" within a sentence, without using the exact string directly (this can be avoided in many ways using just a bit of RegEx). Print as many spaces as there were characters in the original sentence before the aforementioned string appeared, and then the string itself in lowercase.
Hint: The substr() method for string objects is one good way to pick a part of another sentence. Changing the text to lowercase can be done with the method toLowerCase(). toLowerCase().
The automated test takes care of assigning different values to the sentence.
Example output:
TEN... NINE... EIGHT... TWO... ONE... ten
The output of the program must be exactly the same as the example output (the most strict comparison level)
program.js
var words = "The value of this variable is automatically assigned";
function findTheNumber() { ### put your code here ###
console.log(words);
console.log(output);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
