Tuesday, December 17, 2013

blog 29

Blog 29

Work out the values of the variables after each loop runs.

var a = 5;
while (a< 3) {
       a = a - 1;
}



var b = 10
while (b < = 5) {
      b = b - 1;
}

Saturday, December 14, 2013

blog 28

Blog 28

Which is an invalid variable name?

variable        var     visible      value


Which is an invalid variable name?


if         and         a      then


Which is an invalid variable name?

yes      correct    on    true

Friday, December 13, 2013

Wednesday, December 11, 2013

Blog 26

Blog 26
What would you type in the prompt to go thru the first else if?


var gender= prompt('Enter your gender:')

if (gender == ' ' || gender == null)
       {alert('Empty input')}
else if (gender=='Male')
        {alert('Next course starts in 2 weeks')}
else if (gender == 'Female')
         { alert('Next course starts in 1 week')}

Saturday, December 7, 2013

Blog 25

Blog 25

var x = true
var y = false

var a = x && y
var b = x || y
var c = !x


Tell me what

a=
b=
c=

Tuesday, December 3, 2013

Blog 24

Blog 24

If the variable x is already defined and equals 4. Now, if the statement is "document.write(x++);", what would be displayed in the browser?


Sunday, December 1, 2013

Blog 23

Blog 23

How do you create a variable x that is equal to the string "Hello"?
Please write the java script code.