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
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