js学习笔记

 


 

2014-6-13 

1.ask for input with a prompt.使用prompt显示输入文本对话框,并获取用户的输入。

prompt("What is your name");

2.console.log();打印结果。

console.log("hello");

 


 

2014-6-16

1.javascript原始类型

Undefined,Null,Boolean,Number,String

2.typeof返回值

undefined, object, boolean, nber, string.

3.什么情况下值是undefined

(1)变量声明(定义)了但是未初始化

(2)变量未声明(未定义)(此时仅限于typeof操作,其他操作会引起错误)

(3)函数无明确返回值时,返回undefined

4.null和undefined值相等,含义不同。

undefined是声明了变量,但未对其初始化时赋予变量的值(当然还有3中的(2)和(3));

null则用于表示尚未存在的对象,找不到对象时,返回的通常是null。


 

 2014-6-24

 1.jshint

举例:

  • multistr   允许多行字符串(在长字符串中可以使用“ \ ”来在多行中声明长字符串)。

/* jshint multistr:true */
var text = "this is a very long text, it's so long that we have to put it in \
    several lines, and in this way, we avoid to getting a too-long string.\
    Do you understand?";

官网http://www.jshint.com/

文档http://www.jshint.com/docs/

配置http://www.jshint.com/docs/options/ 

中文配置http://www.w3c.com.cn/jshint%E9%85%8D%E7%BD%AE%E8%AF%A6%E8%A7%A3

 

posted @ 2014-06-13 19:35  橘子洲头  阅读(203)  评论(0编辑  收藏  举报