军子好球 發表於 2019-9-2 20:50:00

JavaScript 内置函数有什么?

<h1 class="title-article">javaScript内置函数</h1>
<p><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>1.Date:日期函数</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor 所修立对象的函数参考</strong></span><br><span style="font-size: 18px"><strong>prototype 能够为对象加进的属性和方法</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>getDay() 返回一周中的第几天(0-6)</strong></span><br><span style="font-size: 18px"><strong>getYear() 返回年份.2000年以前为2位,2000(包括)以后为4位</strong></span><br><span style="font-size: 18px"><strong>getFullYear() 返回完全的4位年份数</strong></span><br><span style="font-size: 18px"><strong>getMonth() 返回月份数(0-11)</strong></span><br><span style="font-size: 18px"><strong>getDate() 返回日(1-31)</strong></span><br><span style="font-size: 18px"><strong>getHours() 返回小时数(0-23)</strong></span><br><span style="font-size: 18px"><strong>getMinutes() 返回分钟(0-59)</strong></span><br><span style="font-size: 18px"><strong>getSeconds() 返回秒数(0-59)</strong></span><br><span style="font-size: 18px"><strong>getMilliseconds() 返回毫秒(0-999)</strong></span><br><span style="font-size: 18px"><strong>getUTCDay() 依据国际时间来得到如今是礼拜几(0-6)</strong></span><br><span style="font-size: 18px"><strong>getUTCFullYear() 根据邦际时间来失掉完全的年份</strong></span><br><span style="font-size: 18px"><strong>getUTCMonth() 依据国际时间来得到月份(0-11)</strong></span><br><span style="font-size: 18px"><strong>getUTCDate() 依据国际时间来失掉日(1-31)</strong></span><br><span style="font-size: 18px"><strong>getUTCHours() 依据国际时间来失掉小时(0-23)</strong></span><br><span style="font-size: 18px"><strong>getUTCMinutes() 根据邦际光阴来回归分钟(0-59)</strong></span><br><span style="font-size: 18px"><strong>getUTCSeconds() 依据国际时间来返回秒(0-59)</strong></span><br><span style="font-size: 18px"><strong>getUTCMilliseconds()依据国际时间来返回毫秒(0-999)</strong></span><br><span style="font-size: 18px"><strong>getTime() 前往自1970年1月1号0:0:0到如今一同花来的毫秒数</strong></span><br><span style="font-size: 18px"><strong>getTimezoneOffset()&nbsp;可返回格林威治时间和本地时间之间的时差,以分钟为单位。</strong></span><br><span style="font-size: 18px"><strong>parse(dateString) 返回正在Date字符串中自从1970年1月1日00:00:00以来的毫秒数</strong></span><br><span style="font-size: 18px"><strong>setYear(yearInt) 设置年份.2位数或4位数</strong></span><br><span style="font-size: 18px"><strong>setFullYear(yearInt)设置年份.4位数</strong></span><br><span style="font-size: 18px"><strong>setMonth(monthInt) 设置月份(0-11)</strong></span><br><span style="font-size: 18px"><strong>setDate(dateInt) 设置日(1-31)</strong></span><br><span style="font-size: 18px"><strong>setHours(hourInt) 设置小时数(0-23)</strong></span><br><span style="font-size: 18px"><strong>setMinutes(minInt) 设置分钟数(0-59)</strong></span><br><span style="font-size: 18px"><strong>setSeconds(secInt) 设置秒数(0-59)</strong></span><br><span style="font-size: 18px"><strong>setMilliseconds(milliInt) 设置毫秒(0-999)</strong></span><br><span style="font-size: 18px"><strong>setUTCFullYear(yearInt) 依据国际时间来设置年份</strong></span><br><span style="font-size: 18px"><strong>setUTCMonth(monthInt) 依据国际时间来设置月(0-11)</strong></span><br><span style="font-size: 18px"><strong>setUTCDate(dateInt) 依据国际时间来设置日(1-31)</strong></span><br><span style="font-size: 18px"><strong>setUTCHours(hourInt) 依据国际时间来设置小时</strong></span><br><span style="font-size: 18px"><strong>setUTCMinutes(minInt) 依据国际时间来设置分钟</strong></span><br><span style="font-size: 18px"><strong>setUTCSeconds(secInt) 依据国际时间来设置秒</strong></span><br><span style="font-size: 18px"><strong>setUTCMilliseconds(milliInt)根据邦际时间来设置毫秒</strong></span><br><span style="font-size: 18px"><strong>setTime(timeInt) 设置自1970年1月1日开端的时间.毫秒数</strong></span><br><span style="font-size: 18px"><strong>toGMTString() 依据格林威乱时光将Date对于象的日期(一个数值)改变成一个GMT光阴字符串,如:Weds,15 June l997 14:02:02 GMT</strong></span><br><span style="font-size: 18px"><strong>toUTCString() 依据通用时间将一个Date对象的日期转换为一个字符串</strong></span><br><span style="font-size: 18px"><strong>toLocaleString() 把Date对象的日期(一个数值)改变成一个字符串,使用所在盘算机上配置使用的特定日期格局</strong></span><br><span style="font-size: 18px"><strong>toSource() 显示对象的源代码</strong></span><br><span style="font-size: 18px"><strong>toString() 将日期对象转换为字符串</strong></span><br><span style="font-size: 18px"><strong>UTC(yyyy, mm, dd, hh, mm, ss, msec)往归自格林威乱尺度光阴到指订时光的差距,单位为毫秒</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回日期对象的本初值</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>2.Math:数学函数</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor 所树立对象的函数参考</strong></span><br><span style="font-size: 18px"><strong>prototype 可以为对于象参加的属性和方式</strong></span><br><span style="font-size: 18px"><strong>E 欧推常质,天然对数的顶(约等于2.718)</strong></span><br><span style="font-size: 18px"><strong>LN2 2的天然对数(约即是0.693)</strong></span><br><span style="font-size: 18px"><strong>LN10 10的天然对数(约等于2.302)</strong></span><br><span style="font-size: 18px"><strong>LOG2E 以2为顶的e的对数.(约等于1.442)</strong></span><br><span style="font-size: 18px"><strong>LOG10E 以10为顶的e的对数(约等于0.434)</strong></span><br><span style="font-size: 18px"><strong>PI ∏的值(约即是3.14159)</strong></span><br><span style="font-size: 18px"><strong>SQRT1_2 1/2(0.5)的平方根(便l除以2的平方根,约即是o.707)</strong></span><br><span style="font-size: 18px"><strong>SQRT2 2的平方根(约等于1.414)</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>abs(x) 返回数字的相对值</strong></span><br><span style="font-size: 18px"><strong>acos(x) 返回数字的反余弦值</strong></span><br><span style="font-size: 18px"><strong>asin(x) 返回数字的反正弦值</strong></span><br><span style="font-size: 18px"><strong>atan(x) 返回位于-PI/2 和 PI/2 的反正切值</strong></span><br><span style="font-size: 18px"><strong>atan2(y,x) 前往(x,y)位于 -PI 到 PI 之间的角度</strong></span><br><span style="font-size: 18px"><strong>ceil(x) 返回 x 四舍五入后的最大整数</strong></span><br><span style="font-size: 18px"><strong>cos(x) 前往一个数字的余弦值</strong></span><br><span style="font-size: 18px"><strong>exp(x) 返回 E^x 值</strong></span><br><span style="font-size: 18px"><strong>floor(x) 返回 x 四舍五入后的最小整数</strong></span><br><span style="font-size: 18px"><strong>log(x) 返回底数为E的自然对数</strong></span><br><span style="font-size: 18px"><strong>max(x,y) 返回 x 和 y 之间较大的数</strong></span><br><span style="font-size: 18px"><strong>min(x,y) 返回 x 和 y 之间较小的数</strong></span><br><span style="font-size: 18px"><strong>pow(x,y) 返回 y^x 的值</strong></span><br><span style="font-size: 18px"><strong>random() 返回位于 0 到 1 之间的随机函数</strong></span><br><span style="font-size: 18px"><strong>round(x) 四舍五进后与整</strong></span><br><span style="font-size: 18px"><strong>sin(x) 返回数字的正弦值</strong></span><br><span style="font-size: 18px"><strong>sqrt(x) 返回数字的平方根</strong></span><br><span style="font-size: 18px"><strong>tan(x) 返回一个角度的正切值</strong></span><br><span style="font-size: 18px"><strong>toSource() 显示对象的流代码</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回数教对象的本初值</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>3.Number</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>MAX_VALUE&nbsp; &nbsp; javascript中数字的最大值为:&nbsp; 1.7976931348623157E+308</strong></span><br><span style="font-size: 18px"><strong>MIN_VALUE javascript中数字的最小值5为:&nbsp; &nbsp;E-324</strong></span></p>
<p><span style="font-size: 18px"><strong>示例图如下:</strong></span></p>
<p><span style="font-size: 18px"><strong><img src="https://img2018.cnblogs.com/blog/1746290/201909/1746290-20190918112237833-604141357.jpg" alt=""></strong></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18px"><strong>NaN Equal等于非数字的值。</strong></span><br><span style="font-size: 18px"><strong>NEGATIVE_INFINITY A value that is less than MIN_VALUE.&nbsp; &nbsp; &nbsp; &nbsp;负无穷大小于最小值的值。</strong></span><br><span style="font-size: 18px"><strong>POSOTIVE_INFINITY A value that is greater than MAX_VALUE.&nbsp; &nbsp; &nbsp;Posotive无穷大大于最大值的值。</strong></span><br><span style="font-size: 18px"><strong>prototype A static property of the Number object&nbsp; &nbsp; &nbsp; 将数字对象的静态属性原型化</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>toString Returns a string representing the specified object&nbsp; &nbsp; &nbsp; &nbsp; toString返回表示指定对象的字符串</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回数教对象的本初值</strong></span></p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>4.Boolean</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor 所树立对象的函数参考</strong></span><br><span style="font-size: 18px"><strong>prototype 可以为对象参加的属性和方式</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>toSource() 显示对象的流代码</strong></span><br><span style="font-size: 18px"><strong>toString() 将布我值转换为字符串,并且返回成果</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回布我对象的原始值</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>5.String :字符函数</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor 所树立对象的函数参考</strong></span><br><span style="font-size: 18px"><strong>prototype 可以为对于象参加的属性和方式</strong></span><br><span style="font-size: 18px"><strong>length 返回字符串的字符长度</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>anchor("name")用来把字符串转换为HTML锚面标志内(&lt;A NAME=&gt;)</strong></span><br><span style="font-size: 18px"><strong>big() 把字符串中的文本变成大字体(&lt;BIG&gt;)</strong></span><br><span style="font-size: 18px"><strong>blink() 把字符串中的文本变成闪耀字体(&lt;BLINK&gt;)</strong></span><br><span style="font-size: 18px"><strong>bold() 把字符串中的文本变成乌字体(&lt;B&gt;)</strong></span><br><span style="font-size: 18px"><strong>fixed() 把字符串中的文本变成流动间距字体,便电报情势(&lt;TT&gt;)</strong></span><br><span style="font-size: 18px"><strong>fontcolor(color)设置字符串中文本的色彩(&lt;FONT COLOR=&gt;)</strong></span><br><span style="font-size: 18px"><strong>Fontsize(size) 把字符串中的文本变成指定大小(&lt;FONTSIZE=&gt;)</strong></span><br><span style="font-size: 18px"><strong>italics() 把字符串中的白原变成斜字体(&lt;I&gt;)</strong></span><br><span style="font-size: 18px"><strong>Link(url)用来把字符串转换-HTML链交标志中(&lt;A HREF=&gt;)</strong></span><br><span style="font-size: 18px"><strong>small() 把字符串中的文本变成小字体(&lt;SMALL&gt;)</strong></span><br><span style="font-size: 18px"><strong>strike() 把字符串中的文本变成划掉字体(&lt;STRIKE&gt;)</strong></span><br><span style="font-size: 18px"><strong>sub() 把字符串中的文本变成下标(subscript)字体((SUB&gt;)</strong></span><br><span style="font-size: 18px"><strong>sup() 把字符串中的文本变成上标(superscript)字体(&lt;SUP&gt;)</strong></span><br><span style="font-size: 18px"><strong>charAt(index) 返回指定索引处的字符</strong></span><br><span style="font-size: 18px"><strong>charCodeAt(index)返回一个整数,该整数表现String对象中指定位置处的字符的Unicode编码</strong></span><br><span style="font-size: 18px"><strong>concat(string2)衔接两条或少条字符串</strong></span><br><span style="font-size: 18px"><strong>fromCharCode(num1, num2, …,BB霜, numN)获取指定的Unicode值并返回字符串</strong></span><br><span style="font-size: 18px"><strong>indexOf(searchString, startIndex) 返回字符串中第一个呈现指定字符串的地位</strong></span><br><span style="font-size: 18px"><strong>lastlndexOf(searchString, startIndex) 返回字符串中最后一个呈现指定字符串的地位</strong></span><br><span style="font-size: 18px"><strong>match(regex) 在字符串中查觅指定值</strong></span><br><span style="font-size: 18px"><strong>replace(regex, newString)将字符串中的某些字符替代成其它字符</strong></span><br><span style="font-size: 18px"><strong>search(regex) 针对某施行值对字符串入止查觅</strong></span><br><span style="font-size: 18px"><strong>slice(startIndex, endIndex)将部门字符抽出并在新的字符串中返回剩余局部</strong></span><br><span style="font-size: 18px"><strong>split(delimiter)将字符串分配为数组</strong></span><br><span style="font-size: 18px"><strong>substr(startIndex, length) 从startIndex与,取length个字符</strong></span><br><span style="font-size: 18px"><strong>substring(startIndex, endIndex) 从startIndex和endIndex之间的字符,没有包含endIndex</strong></span><br><span style="font-size: 18px"><strong>toLowerCase() 把字符串中的文本变成小写</strong></span><br><span style="font-size: 18px"><strong>toUpperCase() 把字符串中的白本变成大写</strong></span><br><span style="font-size: 18px"><strong>toSource() 显示对象的源代码</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回字符串对象的原始值</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>6.Array :数组函数</strong></span></p>
<p><span style="font-size: 14pt; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor 所修立对象的函数参考</strong></span><br><span style="font-size: 18px"><strong>prototype 能够为对象加入的属性和方法</strong></span><br><span style="font-size: 18px"><strong>index&nbsp; &nbsp; For an array created by a regular expression match, the zero-based index of the match in the string.</strong></span></p>
<p><span style="font-size: 16px"><strong>由正则表达式匹配创建的数组的索引,字符串中匹配项的从零开始的索引。</strong></span></p>
<p><span style="font-size: 18px"><strong>input&nbsp; &nbsp; For an array created by a regular expression match, reflects the original string against which the regular expression was matched</strong></span></p>
<p><span style="font-size: 18px"><strong>由正则表达式匹配创建的数组的输入反映了与正则表达式匹配的原始字符串。</strong></span></p>
<p><span style="font-size: 18px"><strong>length&nbsp; &nbsp;获取数组元素的个数,即最大下标加1</strong></span></p>
<p>&nbsp;</p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span></p>
<p><span style="font-size: 18px"><strong>concat(array1,arrayn)将两个或两个以上的数组值衔接止来,合并后返回成果</strong></span><br><span style="font-size: 18px"><strong>join(string) 将数组中元素合并为字符串,十月妈咪,string为分隔符.如省详参数则直交合并,不再分隔</strong></span><br><span style="font-size: 18px"><strong>pop() 移除数组中的最后一个元素并返回当元素</strong></span><br><span style="font-size: 18px"><strong>push(value) 在数组的终尾加上一个或多个元素,并且返回新的数组长度值</strong></span><br><span style="font-size: 18px"><strong>reverse() 倒置数组中元素的次序,反背排列</strong></span><br><span style="font-size: 18px"><strong>shift() 移除数组中的第一个元素并返回当元素</strong></span><br><span style="font-size: 18px"><strong>slice(start, deleteCount, ]]]) 返从一个数组中移除一个或少个元素,假如必要,在所移除元素的地位上拔出新元素,返回所移除的元素</strong></span><br><span style="font-size: 18px"><strong>sort(compare Function) 在已指定排序号的情形下,依照元素的字女次序排列,假如不是字符串类型则转换成字符串再排序,返回排序后的数组</strong></span><br><span style="font-size: 18px"><strong>splice() 为数组删除并加加新的元素</strong></span><br><span style="font-size: 18px"><strong>toSource() 显示对象的源代码</strong></span><br><span style="font-size: 18px"><strong>toString() 将数组一切元素返回一个字符串,其间用逗号分隔</strong></span><br><span style="font-size: 18px"><strong>unshift(value)为数组的开端部门加上一个或者少个元荤,并且返回当数组的新长度</strong></span><br><span style="font-size: 18px"><strong>valueOf() 返回数组对象的原始值</strong></span><em id="__mceDel"><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br></em><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>7.RegExp</strong></span><em id="__mceDel"><br></em></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>$1, ..., $9 Parenthesized substring matches, if any.带圆括号的子字符串匹配(如果有)。</strong></span><br><span style="font-size: 18px"><strong>$_ See input.参见输入。</strong></span><br><span style="font-size: 18px"><strong>$* See multiline.请参见多行。</strong></span><br><span style="font-size: 18px"><strong>$&amp; See lastMatch.</strong></span><br><span style="font-size: 18px"><strong>$+ See lastParen.</strong></span><br><span style="font-size: 18px"><strong>$` See leftContext.</strong></span><br><span style="font-size: 18px"><strong>$' See rightContext.</strong></span><br><span style="font-size: 18px"><strong>global&nbsp; &nbsp; Whether or not to test the regular expression against all possible matches in a string, or only against the first.全局是否针对字符串中的所有可能匹配项测试正则表达式,或仅针对第一个匹配项测试正则表达式。</strong></span><br><span style="font-size: 18px"><strong>ignoreCase&nbsp; &nbsp; &nbsp;Whether or not to ignore case while attempting a match in a string.在字符串中尝试匹配时是否忽略大小写。</strong></span><br><span style="font-size: 18px"><strong>input&nbsp; &nbsp; &nbsp;The string against which a regular expression is matched.输入与正则表达式匹配的字符串。</strong></span><br><span style="font-size: 18px"><strong>lastIndex&nbsp; &nbsp; The index at which to start the next match.&nbsp; &nbsp;lastIndex开始下一个匹配的索引。</strong></span><br><span style="font-size: 18px"><strong>lastMatch&nbsp; &nbsp; &nbsp; The last matched characters.最后匹配的字符。</strong></span><br><span style="font-size: 18px"><strong>lastParen&nbsp; &nbsp; The last parenthesized substring match, if any.最后一个带圆括号的子字符串匹配(如果有)。</strong></span><br><span style="font-size: 18px"><strong>leftContext&nbsp; &nbsp; &nbsp;The substring preceding the most recent match.最近一次匹配之前的子字符串。</strong></span><br><span style="font-size: 18px"><strong>multiline&nbsp; &nbsp; &nbsp;Whether or not to search in strings across multiple lines.是否跨多行搜索字符串。</strong></span><br><span style="font-size: 18px"><strong>rightContext&nbsp; &nbsp; &nbsp;The substring following the most recent match.最近一次匹配后的子字符串。</strong></span><br><span style="font-size: 18px"><strong>source&nbsp; &nbsp; &nbsp;The text of the pattern.模式的文本。</strong></span></p>
<p>&nbsp;</p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>compile&nbsp; &nbsp; Compiles a regular expression object.&nbsp; &nbsp; &nbsp; compile编译正则表达式对象。</strong></span><br><span style="font-size: 18px"><strong>exec&nbsp; &nbsp; &nbsp;Executes a search for a match in its string parameter.&nbsp; &nbsp;exec执行对其字符串参数中匹配项的搜索。</strong></span><br><span style="font-size: 18px"><strong>test&nbsp; &nbsp; &nbsp;Tests for a match in its string parameter测试字符串参数是否匹配</strong></span></p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>8.Function</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>arguments&nbsp; &nbsp; &nbsp;An array corresponding to the arguments passed to a function.&nbsp;与传递给函数的参数相对应的数组。</strong></span><br><span style="font-size: 18px"><strong>arity&nbsp; &nbsp; &nbsp;Indicates the number of arguments expected by the function.指示函数所需的参数数。</strong></span><br><span style="font-size: 18px"><strong>caller&nbsp; &nbsp; Specifies which function called the current function.指定调用当前函数的函数。</strong></span><br><span style="font-size: 18px"><strong>prototype&nbsp; &nbsp; Allows the addition of properties to a Function object.允许向函数对象添加属性。</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>toString&nbsp; &nbsp; Returns a string representing the specified object.返回表示指定对象的字符串。</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>9.Object</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>constructor&nbsp; &nbsp; Specifies the function that creates an object's prototype.指定创建对象原型的函数。</strong></span><br><span style="font-size: 18px"><strong>prototype&nbsp; &nbsp; Allows the addition of properties to all objects.允许向所有对象添加属性。</strong></span></p>
<p><span style="font-size: 18px"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>eval&nbsp; &nbsp; Evaluates a string of&nbsp;JavaScript&nbsp;code in the context of the specified object.在指定对象的上下文中计算一个javascript代码字符串。</strong></span><br><span style="font-size: 18px"><strong>toString&nbsp; &nbsp; Returns a string representing the specified object.返回表示指定对象的字符串。</strong></span><br><span style="font-size: 18px"><strong>unwatch&nbsp; &nbsp; Removes a watchpoint from a 属性流 the object.从对象中移除监视点。</strong></span><br><span style="font-size: 18px"><strong>valueOf&nbsp; &nbsp; &nbsp;Returns the primitive value of the specified object.返回指定对象的基元值。</strong></span><br><span style="font-size: 18px"><strong>watch&nbsp; &nbsp; &nbsp; Adds a watchpoint to a 属性源 the object.为对象添加一个watchpoint。</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>10.齐局</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>Infinity 指定一个正负无限大的数值</strong></span><br><span style="font-size: 18px"><strong>NaN 指定一个 “非数字” 值</strong></span><br><span style="font-size: 18px"><strong>undefined 指订一个已被赋值的变质</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>方法:</strong></span><br><span style="font-size: 18px"><strong>decodeURI() 为加稀的URI入止解码</strong></span><br><span style="font-size: 18px"><strong>decodeURIComponent() 为加稀的URI组件解码</strong></span><br><span style="font-size: 18px"><strong>encodeURI() 将字符串加密为URI</strong></span><br><span style="font-size: 18px"><strong>encodeURIComponent() 将字符串加稀为URI组件</strong></span><br><span style="font-size: 18px"><strong>escape(string) 加密一个字符串</strong></span><br><span style="font-size: 18px"><strong>() 使用escape()对一个字符串入止解码</strong></span><br><span style="font-size: 18px"><strong>eval_r(string) 断定一个字符串并将其以足本代码的情势施行</strong></span><br><span style="font-size: 18px"><strong>isFinite(number) 检测一个值能否为一个有限数字,返回True或False</strong></span><br><span style="font-size: 18px"><strong>isNaN(string) 检测一个值能否没有是一个有限数字</strong></span><br><span style="font-size: 18px"><strong>Number() 将一个对象的值转换为一个数字</strong></span><br><span style="font-size: 18px"><strong>parseFloat(string) 将一个字符串解析为一个浮面数字</strong></span><br><span style="font-size: 18px"><strong>parseInt(string) 将一个字符串解析为一个整数,没有是四舍五进操做,而是切尾</strong></span><br><span style="font-size: 18px"><strong>String(object) 将一个对象值转换为一个字符串</strong></span><br><span style="font-size: 18px"><strong>number(object)</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>11.事件</strong></span></p>
<p><span style="font-size: 18px; color: rgba(255, 0, 0, 1)"><strong>属性:</strong></span><br><span style="font-size: 18px"><strong>a.窗口事件,只在body和frameset元素中才有效</strong></span><br><span style="font-size: 18px"><strong>onload 页里或者图片加载完成时</strong></span><br><span style="font-size: 18px"><strong>onunload 用户分开页里时</strong></span><br><span style="font-size: 18px"><strong>onchange 表单元素的内容转变时触发</strong></span><br><span style="font-size: 18px"><strong>onsubmit 表单提交时触发</strong></span><br><span style="font-size: 18px"><strong>onreset 表单重置时触发</strong></span><br><span style="font-size: 18px"><strong>onselect 在文本框中的文本被选中时</strong></span><br><span style="font-size: 18px"><strong>onblur 元素失去焦点时</strong></span><br><span style="font-size: 18px"><strong>onfocus 元素获取焦点时</strong></span><br><span style="font-size: 18px"><strong>c.键盘事件,在base,bdo,br,frame,frameset,head,html,iframe,meta,param,script,style,title元素里皆无效</strong></span><br><span style="font-size: 18px"><strong>onkeydown 某个键盘按键被按下时</strong></span><br><span style="font-size: 18px"><strong>onkeypress 某个键盘按键被按下并松开时</strong></span><br><span style="font-size: 18px"><strong>onkeyup 某个键盘按键被松开时</strong></span><br><span style="font-size: 18px"><strong>d.正在base,bdo,br,frame,frameset,head,html,iframe,meta,param,script,style,title元素里皆无效</strong></span><br><span style="font-size: 18px"><strong>onclick 当用户点击某个对象时调用的事件句柄</strong></span><br><span style="font-size: 18px"><strong>ondblclick 当用户双击某个对象时调用的事件句柄</strong></span><br><span style="font-size: 18px"><strong>onmousedown 鼠标按钮被按下时</strong></span><br><span style="font-size: 18px"><strong>onmousemove 鼠标被移动时</strong></span><br><span style="font-size: 18px"><strong>onmouseout 鼠标从某元素移开</strong></span><br><span style="font-size: 18px"><strong>onmouseover 鼠标移到某元素之上</strong></span><br><span style="font-size: 18px"><strong>onmouseup 鼠标按键被松开</strong></span><br><span style="font-size: 18px"><strong>&nbsp;</strong></span><br> <br><span style="font-size: 18pt; color: rgba(255, 0, 0, 1)"><strong>e.其他</strong></span><br><span style="font-size: 18px"><strong>onresize 窗口和框架被重新调整大小</strong></span><br><span style="font-size: 18px"><strong>onabort 图片下载被中断时</strong></span><br><span style="font-size: 18px"><strong>onerror 该加载文档或图片时产生错误时</strong></span><br><span style="font-size: 18px"><strong>自定义对象:有始始化对象和定义结构函数的对象两类方法</strong></span><br><span style="font-size: 18px"><strong>a:始始化对象</strong></span><br><span style="font-size: 18px"><strong>例如: 对象={属性1:值1;属性2:值2;......属性n:值n} 注意:每个属性/值对之间用分号隔开;</strong></span><br><span style="font-size: 18px"><strong>b: 定义结构函数的对象</strong></span><br><span style="font-size: 18px"><strong>例如:</strong></span><br><span style="font-size: 18px"><strong>function 函数实(属性1, 属性2,......属性N){</strong></span><br><span style="font-size: 18px"><strong>this.属性1=属性值1;</strong></span><br><span style="font-size: 18px"><strong>this.属性2=属性值2;</strong></span><br><span style="font-size: 18px"><strong>this.属性n=属性值n;</strong></span><br><span style="font-size: 18px"><strong>this.方法名1=函数名1;</strong></span><br><span style="font-size: 18px"><strong>this.方法实2=函数实2;</strong></span><br><span style="font-size: 18px"><strong>}</strong></span><br>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/shihaiying/p/11448928.html
頁: [1]
查看完整版本: JavaScript 内置函数有什么?