# JavaScript 对象的基础知识 - 对象的方法的引用

**URL:** <https://www.isharkfly.com/t/javascript/8642>\
**Category:** 前端\
**Created:** [October 27, 2012, 4:00pm UTC](https://www.isharkfly.com/t/javascript/8642 "2012-10-27T16:00:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [October 27, 2012, 4:00pm UTC](https://www.isharkfly.com/t/javascript/8642/1 "2012-10-27T16:00:21Z")

</div>

在JavaScript中对象方法的引用是非常简单的。`ObjectName.methods()`实际上methods()=FunctionName方法实质上是一个函数。

如引用university对象中的showmy（）方法，则可使用：`
document.write (university.showmy())`或：`document.write(university)`如引用math内部对象中cos()的方法

则：`
with(math)
document.write(cos(35));
document.write(cos(80));`若不使用with则引用时相对要复杂些：`
document.write(Math.cos(35))
document.write(math.sin(80))`
