日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

JS 对象介绍

發布時間:2023/12/10 javascript 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JS 对象介绍 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


?
JavaScript is an Object Oriented Programming (OOP) language.
JS是面向對象的編程語言(面向對象)。

An OOP language allows you to define your own objects and make your own variable types.
OOP語言可以讓你自定義對象和變量類型。


--------------------------------------------------------------------------------

Object Oriented Programming
被安置對象的編程

JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to define your

own objects and make your own variable types.
JS是(OOP)語言,這就可以讓你定義....(和上面的重復)

However, creating your own objects will be explained later, in the Advanced JavaScript section. We will

start by looking at the built-in JavaScript objects, and how they are used. The next pages will explain

each built-in JavaScript object in detail.
然而,我們將晚些在高級JS里介紹建立自定義對象。我們將開始觀察內建JS對象和如何使用它們。下頁將詳細介紹每個

內建JS對象

Note that an object is just a special kind of data. An object has properties and methods.
注意,對象只是特殊類型的數據。對象有屬性和方法


--------------------------------------------------------------------------------

Properties
屬性

Properties are the values associated with an object.
屬性是對象的相連值

In the following example we are using the length property of the String object to return the number of

characters in a string:
下面的例子我么使用了字符串對象的長度屬性來返回字符的數量:

<script type="text/javascript">

var txt="Hello World!"
document.write(txt.length)

</script>

The output of the code above will be:
上面的代碼就會輸出:

12


--------------------------------------------------------------------------------

Methods
方法

Methods are the actions that can be performed on objects.
對象的方法可以執行行為。

In the following example we are using the toUpperCase() method of the String object to display a text in

uppercase letters:
下面的例子使用了字符串對象的toUpperCase()方法來顯示出文字的大寫:

<script type="text/javascript">

var str="Hello world!"
document.write(str.toUpperCase())

</script>

The output of the code above will be:
上面的代碼輸出:

HELLO WORLD!

轉載于:https://www.cnblogs.com/tuichujxu/archive/2010/01/19/1651266.html

總結

以上是生活随笔為你收集整理的JS 对象介绍的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。