Here is the example from book
I'm getting syntax error:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phrase-o-matic</title>
<script>
function makePhrases(){
var words1 = ["24/7", "multi-tier", "30,000 foot", "B-to-B", "win-win"];
var words2 = ["empowered", "value-added", "oriented", "focused", "simplified"];
var words3 = ["process", "solutions", "tipping-point", "strategy", vision"]
var rand1 = Math.floor(Math.random()*words1.length);
var rand2 = Math.floor(Math.random()*words2.length);
var rand3 = Math.floor(Math.random()*words3.length);
var phrase = words1[rand1]+""+words2[rand2] + "" + words3[rand3];
alert(phrase);
}
makePhrases();
</script>
</head>
<body>
</body>
</html>
I'm learning about javascript functions, and cant get it to work.
I'm getting syntax error:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phrase-o-matic</title>
<script>
function makePhrases(){
var words1 = ["24/7", "multi-tier", "30,000 foot", "B-to-B", "win-win"];
var words2 = ["empowered", "value-added", "oriented", "focused", "simplified"];
var words3 = ["process", "solutions", "tipping-point", "strategy", vision"]
var rand1 = Math.floor(Math.random()*words1.length);
var rand2 = Math.floor(Math.random()*words2.length);
var rand3 = Math.floor(Math.random()*words3.length);
var phrase = words1[rand1]+""+words2[rand2] + "" + words3[rand3];
alert(phrase);
}
makePhrases();
</script>
</head>
<body>
</body>
</html>
I'm learning about javascript functions, and cant get it to work.
Dislike ads? Remove them and support the forum:
Subscribe to Fastlane Insiders.