Create an HTML page with the following functionality i. It should ask the user 2 inputs: 1. Enter a Sentence (any English sentence) 2. Enter a Letter (any letter from A to Z) ii. On clicking on "Submit" button it should output the rest of the sentence after the first occurrence of the letter in the sentence iii. If the letter does not exist in the sentence, output -> "The letter does not exist in the sentence". iv. Example 1 1. Sentence: Hello World! 2. Letter: r 3. Result: ld! v. Example 2 1. Sentence: Hello World! 2. Letter: o 3. Result: World1 What I have tried: <pre>Create an HTML page with the following functionality i. It should ask the user 2 inputs: 1. Enter a Sentence (any English sentence) 2. Enter a Letter (any letter from A to Z) ii. On clicking on "Submit" button it should output the rest of the sentence after the first occurrence of the letter in the sentence iii. If the letter does not exist in the sentence, output -> "The letter does not exist in the sentence". iv. Example 1 1. Sentence: Hello World! 2. Letter: r 3. Result: ld! v. Example 2 1. Sentence: Hello World! 2. Letter: o 3. Result: World1
var sentence = prompt("sentence : "); var letter = prompt("letter : "); var position = sentence.indexOf(letter); var result = sentence.substring(position , sentence.length ) ;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)