登录  /  注册
首页 > web前端 > js教程 > 正文

JS 对象介绍_js面向对象

php中文网
发布: 2016-05-16 18:36:20
原创
1208人浏览过

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:
下面的例子我么使用了字符串对象的长度属性来返回字符的数量:

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()方法来显示出文字的大写:

The output of the code above will be:
上面的代码输出:
HELLO WORLD!

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号