123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <div>你好</div>
- <script>
- var oBox = document.getElementsByTagName("div")[0];
- // oBox.onclick = function(){
- // console.log("hello");
- // }
- // oBox.innerText = "<span>hello</span>";
- // oBox.innerHTML = "<span>hello</span>";
- oBox.remove();
- // oBox.addEventListener("click",function(){
- // console.log("hello");
- // });
- // var a = 10;
- // function foo(){
- // var a = 20;
- // }
- // var b = 10;
- // var c = b;
- // b = 20;
- // console.log(c);
- // var arr1 = [1,2,3,4,5];
- // var arr2 = arr1;
- // arr1[0] = "hello";
- // console.log(arr2);
- // function foo(){
- // console.log("hello");
- // }
- // foo();
- // var foo = function(){
- // console.log("hello");
- // }
- // (function(){
- // console.log("hello");
- // })();
- // console.log("a"+1);
- // var obj = {
- // name:"hello",
- // age:10
- // }
- // var arr = [1,2,3,4,5];
- // var str = "hello";
- // delete obj.name;
- // console.log(obj);
- // console.log(typeof null);
- // console.log(typeof str);
- // console.log(typeof obj);
- // console.log(typeof arr);
-
- // for(var key in obj){
- // console.log(obj[key]);
- // }
- // console.log(Array.prototype);
- // var a = 1;
- // switch(a){
- // case a>1:console.log(1);break;
- // case a>2:console.log(2);break;
- // default:console.log("default");break;
- // }
- // var a = false;
- // var d = 0;
- // var c = d||a;//或运算用作赋值操作,如果第一个值为真,则返回第一个值,否则返回第二个值
- // console.log(c);
- // var b = a>1?"hello":"world";
- // var a = 10;
- // console.log(a.toString());
- // console.log(a+"");
-
- // var arr = [1,2,3,4,5];
- // arr.push(6);
- // // arr[5] = 6;
- // console.log(arr);
- // var obj = {
- // name:"hello",
- // age:10,
- // name1:"world"
- // }
- // var a = 1;
- // console.log(obj['name'+a]);
- try {
- console.log(abc);
- } catch (error) {
- console.log(
- error
- )
- }
- console.log("hello");
- // console.log(aaa);
- // console.log("world");
- </script>
- </body>
- </html>
|