You will need to interact with the browser a bit to prompt the user to give input and to write the result to the screen. Here are some examples to get you started.
var input = prompt('Enter something here'); // Displays a pop-up textbox in the browser
document.write(<TEXT>); // Writes to the document/page- In the
scriptsfolder, create a new file namedwarmup.js. - In
warmup.html, add a script tag in the<body>. A script tag example:<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fpath%2Fto%2F.js%2Ffile"></script>
Find the highest number
- Inside
warmup.js, create a function namedfindHighestNumwhich takes no parameters. - This function will continuously prompt the user for a number and remember the highest number found until the user enters zero. Tip: probably need to convert the input string to a number of some kind
- When zero is entered, the loop should exit and it should print the highest number to the screen.
Count letters in text
- Inside
warmup.js, create a function namedcountLetterswhich takes no parameters. - Go to http://www.lipsum.com/feed/html and copy a paragraph of dummy text from the page. It doesn't matter which one.
- Inside the function, create a variable to hold the text.
- Prompt the user for input, which should be a single letter. This value, if valid, should be given as parameter to the function you create next:
- Inside the function, create a new function named
countLetterwhich takes one parameter namedletter. - Inside
countLetter, find the number of occurrences of the letter given as parameter. Tip: usingvar characters = text.split('');will give you the chars in a string which you can then iterate over and check for matches. - Print the number of occurrences to the screen.