JavaScript(1) 简介
来源:互联网 发布:数据透视表的应用 编辑:程序博客网 时间:2024/05/20 13:36
C-like Syntax
If several Objected-Oriented programming languages learned,you will find that p-languages are the same thing from their skins,c++,java,c#.It's not serious,just part of feelings.But if you mastered one OO-language,It's easy to conquer javascript.
- Case-sensitivity:Every object of javascript is Case-sensitivity,it means thatFunction people()is different fromFunction People().
- Comments:the same with c,use /**/ or //.
- Statements terminal sign:semicolon.Although omitting this sign makes no mistakes,you'd better to always include one,It's some kind of conventions.And maybe It's required in the next version.
Data types
- simples: Undefined,Boolean,Null,String,Number.
- complex:Object.yeah,It's complex enough,you will find it.
Undefined:
var message; //this variable is declared but has a value of undefined//make sure this variable does not declared//var agealert(message); //”undefined”alert(age); //causes an errorIn this two cases,maybe the browser(like Chrome) shows the same errors,but only the none-defined variable makes a mistake-interrupt.
Null:
var ba = Boolean(1);//ba = truevar ba = Boolean(0);//ba = falsevar ba = Boolean("");//ba = falsevar ba = Boolean("noemptystring");//ba = trueEvery not-null object will be covered to true,and the opposite is false.
Number:
Number type is double-precision value.It is easy to get the range of Number type using the property Number.MAX_VALUE and Number.MIN_VALUE.There is a special value in Number called NaN which is short for Not a Number,this value is not equal to any value even itself:NaN==Nan returns false.
Just like Boolean(),the function Number() can translate every object to number type,principle of the conversion is some a little complex,I don't want to copy it here.Generally,parseInt() andparseFloat() are better choice.
String:
String type in Javascript is very like it in C#/JAVA.Once defined,the value of it will never change.
There are two ways to translate an object to string,the general way is using function toString(),most of datatypes in Javascript have this function except null and undefined.Another method is String( argument ),it returns the same value when the arguments is not null or undefined,if null or undefined passed in,then this function will return "null" and "undefined".
Object:
Object is the base of all objects in javascript.everything in javascript is object.
- JavaScript(1) 简介
- 1-JavaScript简介
- Javascript 简介1
- 第1章 JavaScript简介
- JavaScript学习1-JS简介
- 第1章 JavaScript 简介
- 第1章 JavaScript 简介
- JavaScript--简介
- JavaScript 简介
- JavaScript 简介
- JavaScript简介
- javaScript 简介
- JavaScript简介
- JavaScript简介
- Javascript 简介
- JavaScript 简介
- JavaScript简介
- javaScript简介
- 答读者问(16):一个研二学生有关论文和学习的相关疑问
- 马士兵struts2视频教程第四十四集
- 计算日期天数
- UVA - 424 Integer Inquiry
- cs里提示并转向
- JavaScript(1) 简介
- cs 里提示并返回
- ios 定时器
- 初学驱动开发书籍介绍
- Android进程内存管理
- Insertion Sort List
- SQL 到 Mongo 的对应表
- java反射机制()
- 静态链接和动态链接