JavaScript: Fill in the blank below to complete the following code. When the cod
ID: 3663501 • Letter: J
Question
JavaScript:
Fill in the blank below to complete the following code. When the code is run, the output should be, CRANBERRIES ARE HIGH IN ANTIOXIDANTS."
var message = "Cranberries are high in antioxidants.";
var newMessage = "All your base are belong to us.";
newMessage = message._____________________________;
newMessage;
2.
Grueges are microscopic animals that live to be 14 days old as long as they eat every 24 hours. The age and last feeding for a grueges is below. Write JavaScript code to determine whether the gruege is alive or not.
Explanation / Answer
1. newMessage = message.toUpperCase();
which converts all lower case letters to upper case letters.
2.
<!DOCTYPE html>
<html>
<body>
<p>Input your age and click the button:</p>
<input id="age" value="12" />
<button>Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var age, voteable;
age = Number(document.getElementById("age").value);
if (isNaN(age)) {
voteable = "Error in input";
} else {
voteable = (age < 14) ? "Still alive" : "Died";
}
document.getElementById("demo").innerHTML = voteable;
}
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.