We want to make this open-source project available for people all around the world.

Help to translate the content of this tutorial to your language!

BuyEPUB/PDF
Share
back to the lesson

The name of JavaScript

importance: 2

Using the if..else construct, write the code which asks: ‘What is the "official" name of JavaScript?’

If the visitor enters "ECMAScript", then output "Right!", otherwise – output: "You don’t know? ECMAScript!"

Demo in new window

<!DOCTYPE html>
<html>
<body>
 <script>
 'use strict';
 let value = prompt('What is the "official" name of JavaScript?', '');
 if (value == 'ECMAScript') {
 alert('Right!');
 } else {
 alert("You don't know? ECMAScript!");
 }
 </script>
</body>
</html>

AltStyle によって変換されたページ (->オリジナル) /