zoukankan      html  css  js  c++  java
  • Javascript基础1

    1.数据类型:null和undefined区别?

      undefined是指原生类型没有定义,而null是指对象没定义.

    2.数组声明:['a',3,'hello',true];

    3.控制结构:for(var i=0; i<test.length; i++){//...........}

      如果对象:var obj = {name:'aa',age:23};

      for(var k in obj){console.log(k+obj[k]);}

    4.对象操作:

      str.length;  str.substr(2,3);   

      var aa =['a','b','c','d'];

      var bb = 'a,b,c,d,e';

      对象合并为字符串:aa.join(',');

      字符串分解为对象:bb.split(',');

      返回字符串出现的位置:indexOf(string);

      toLowerCase//toUpperCase//replace(str1,str2);

      日期对象:

      getFullYear();//

      getMonth()//

      getDate();

      getHours();

      getMinutes();

      getSeconds();

      getMilliseconds();

      Math数学对象:

      ceil(..);  //    >=此数的最小整数.

      floor(..)//   <=此数的最大整数

      min(d1,d2,d3);返回最小值

      max(d1,d2,d3);

      random();返回随机数

    window内置对象

      window.navigator

      window.location 地址栏对象

      window.history  历史记录

        window.history.forward();

        window.history.back();

      window.screen  屏幕对象

      window.screen.width  获取屏幕宽度

      window.document  文档对象

  • 相关阅读:
    网站建设怎样添加设为首页和加入收藏代码
    在WEB项目中调用QQ通讯组件打开QQ聊天界面
    网页引用Font Awesome图标
    jQuery鼠标划入划出
    django框架
    python连接数据库:
    数据库:
    TCP:
    数据库:
    Excel在任务栏中只显示一个窗口的解决办法
  • 原文地址:https://www.cnblogs.com/bing2017/p/7575587.html
Copyright © 2011-2022 走看看