程序段如下:var x = new Boolean(false);if (x) { alert('hi');}var y = Boolean(0);if (y) { alert('hello');}最后的显示结果是( )
A: hi
B: hi hello
C: hello
D: 不显示
A: hi
B: hi hello
C: hello
D: 不显示
举一反三
- 下列JavaScript语句中能正确执行的是___________ 。 A: document.printf("Welcome to You!"); B: var x=5;if (x) {alert("Hello World! ");} C: var z,if; D: {var x=4,y=9;alert("Hello World! ");
- 已知x = 'hello world,hello jinan,hello python',那么执行语句x = x.replace('hello','hi',1)之后,x的值为____________。 A: 'hi world,hello jinan,hello python' B: 'hello world,hello jinan,hello python' C: 'hi world,hi jinan,hello python' D: 'hi world,hi jinan,hi python'
- 下面代码的运行结果是( )。var str= "hello world" ;var str1=str.toUpperCase();var str2=str.toLowerCase() ;alert (str1) ;alert (str2) ; A: "HELLO WORLD","HELLO WORLD" B: "HELLO WORLD","hello world" C: "hello worl","HELLO WORLD" D: "hello world","hello world"
- 已知字符串 x = 'hello Python',那么执行语句 x.replace('hello', 'hi') 之后,x的值为____________。 A: 'hi Python' B: 'hello Python' C: hello Python D: hi Python
- var str="hello"; var str1 = new String("hello"); alert(str.equals(str1));的值是()