JS中常用的内部对象

来源:互联网 发布:淘宝自动刷单软件 编辑:程序博客网 时间:2024/05/16 07:01

             常用的js内部对象有11个:ArrayBooleanDateFunctionGlobalMathNumberObjectRegExpError 以及 String

Array对象

提供对创建任何数据类型的数组的支持。

arrayObj = new Array()
arrayObj = new Array([size])

arrayObj = new Array([element0[, element1[, ...[,elementN]]]])

参数

arrayObj

必选项。要赋值为 Array 对象的变量名。

size

可选项。可选项数组的大小。由于数组的下标是从零开始,创建的元素的下标将从零到 size -1。

element0,...,elementN

可选项。要放到数组中的元素。这将创建具有 n + 1 个元素的长度为 n + 1 的数组。使用该语法时必须有一个以上元素。

属性

constructor 属性 | length 属性 | prototype 属性

方法

concat 方法 | join 方法 | pop 方法 | push 方法 | reverse 方法 | shift 方法 | slice 方法 | sort 方法 | splice 方法 | toLocaleString 方法 | toString 方法 |unshift 方法 | valueOf 方法

String对象

可用于处理或格式化文本字符串以及确定和定位字符串中的子字符串。

语法

newString = new String(["stringLiteral"])

参数

newString

必选项。要赋值为 String 对象的变量名。

stringLiteral

可选项。任意 Unicode 字符群。

属性

constructor 属性 | length 属性 | prototype 属性

方法

anchor 方法 | big 方法 | blink 方法 | bold 方法 | charAt 方法 | charCodeAt 方法 | concat 方法 |fixed 方法 | fontcolor 方法 | fontsize 方法 | fromCharCode 方法 | indexOf 方法 |italics 方法 | lastIndexOf 方法 | link 方法 | match 方法 | replace 方法 | search 方法 | slice 方法 | small 方法 | split 方法 | strike 方法 | sub 方法 | substr 方法 | substring 方法 | sup 方法 | toLowerCase 方法 | toUpperCase 方法 | toString 方法 |valueOf 方法

Math 对象

是一个固有对象,提供基本数学函数和常数。

说明

Math 对象不能用 new 运算符创建,如果试图这样做则给出错误。该对象在装载脚本引擎时由该引擎创建。其所有方法和属性在脚本中总是可用。

属性

E 属性 | LN2 属性 | LN10 属性 | LOG2E 属性 | LOG10E 属性 | PI 属性 | SQRT1_2 属性 | SQRT2 属性

方法

abs 方法 |acos 方法 | asin 方法 | atan 方法 | atan2 方法 | ceil 方法 | cos 方法 | exp 方法 | floor 方法 | log 方法 | max 方法 | min 方法 | pow 方法 | random 方法 | round 方法 | sin 方法 | sqrt 方法 | tan 方法

Date 对象

启用基本存储器并取得日期和时间。

dateObj = new Date()
dateObj = new Date(dateVal)
dateObj = new Date(year, month, date[, hours[, minutes[, seconds[,ms]]]])

属性

constructor 属性 |prototype 属性

方法

getDate 方法 |getDay 方法 | getFullYear 方法 | getHours 方法 |getMilliseconds 方法 | getMinutes 方法 | getMonth 方法 |getSeconds 方法 | getTime 方法 | getTimezoneOffset 方法 |getUTCDate 方法 | getUTCDay 方法 | getUTCFullYear 方法 |getUTCHours 方法 | getUTCMilliSeconds 方法 | getUTCMinutes 方法 |getUTCMonth 方法 | getUTCSeconds 方法 | getVarDate 方法 |getYear 方法 | setDate 方法 | setFullYear 方法 |setHours 方法 | setMilliSeconds 方法 | setMinutes 方法 |setMonth 方法 | setSeconds 方法 | setTime 方法 | setUTCDate 方法 | setUTCFullYear 方法 |setUTCHours 方法 | setUTCMilliseconds 方法 | setUTCMinutes 方法 |setUTCMonth 方法 | setUTCSeconds 方法 | setYear 方法 |toGMTString 方法 | toLocaleString 方法 | toUTCString 方法 |toString 方法 | valueOf 方法 | parse 方法 | UTC 方法


Number 对象

代表数值数据类型和提供数值常数的对象。

numObj = new Number(value)

属性

MAX_VALUE 属性 | MIN_VALUE 属性 | NaN 属性 | NEGATIVE_INFINITY 属性 | POSITIVE_INFINITY 属性 |constructor 属性 | prototype 属性

方法

toLocaleString 方法 | toString 方法 | valueOf 方法

这个只是js   API中的一部分 ,需要的话可以下一个API好好研究。


0 0
原创粉丝点击