Question and answer on javascript from https://www.w3resource.com/javascript-exercises/javascript-basic-exercises.php