Beruflich Dokumente
Kultur Dokumente
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>Mystery Script</title>
<script>
var y;
var x = 1;
var total = 0;
while ( x <= 10 )
{
y = x * x;
document.writeln( "<p>" + y + "</p>" );
total += y;
++x;
}// end while
2. Which of the following JavaScript statements contain variables whose values are changed?
a. p = i + j + k + 7;
b. window.alert( "variables whose values are destroyed" );
c. window.alert( "a = 5" );
d. stringVal = window.prompt( "Enter string:" );
3. Given y = ax3 + 7, which of the following are correct JavaScript statements for this equation?
a. y = a * x * x * x + 7;
b. y = a * x * x * (x + 7);
c. y = (a * x) * x * (x + 7);
d. y = (a * x) * x * x + 7;
e. y = a * (x * x * x) + 7;
f. y = a * x * (x * x + 7);
4. Write a script that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers
separated by one space. Write the script using the following methods:
a. Using one document.writeln statement.
b. Using four document.write statements.