Objects 
An object is a self-contained collection of data. This data comes in to forms:  properties and methods
  • A property is a variable belonging to an object
  • A method is a function that the object can invoke
 
In JavaScript you can create your own objects , called user-defined objects.
JavaScript also coms with a range of premade objects that you can use in your scipts. These are called 
native objects .
 
You may have been seen objects in action. Array is an object.
Whenever you initialize an array using the new keyword, you are creating a new instance of the
objects.when you want to find out how many elements are in an array, you do so by using the length property.
eg :  var beatles = new Array();
        beatles.length;
 
Other native objects examples include Math and Date, both of which have very useful methods for dealing 
with numbers and datas respectively.
For example : 
    var num = 7.561;
    var num = Math.round(num) ;
The Date object can be used to store and retrive infomation about a specific date and time.
If you create a new instance of the Date object, it will be automatically be prefilled with the current date
and time : eg :
  var current_date = new Date();
  var today = current_date.getDay();
 
Host objects 
Native objects arent the only kind of premade objects that you can use in your scripts. 
Another kind of objects supplied not by the JavaScript language itself, but by the environment in 
which its running. In the case of Web, the environment is the web browser. 
Objects that are supplied by the web browser are called host objects.
Host objects include Form, Image, and Element. These objects can be used to get information 
about forms, images, and form elements within a web pages.

So lets take a summary of the objects in JavaScript, There are three kinds of objects in JavaScript :

  •   User-defined objects created from scratch by the programmer.
  •   Native objects like Array, Math and Date, which are built in to JavaScript
  •   Host objects that are provided by the browser

A brief look at the Objects in JavaScript的更多相关文章

  1. Promise & Deferred Objects in JavaScript Pt.2: in Practice

    原文:http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt2-practical-use Intr ...

  2. Promise & Deferred objects in JavaScript Pt.1: Theory and Semantics.

    原文:http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semanti ...

  3. JavaScript简易教程(转)

    原文:http://www.cnblogs.com/yanhaijing/p/3685304.html 这是我所知道的最完整最简洁的JavaScript基础教程. 这篇文章带你尽快走进JavaScri ...

  4. 6 个JavaScript日期处理库

    1. Later.js Later.js, a stadalone JavaScript library, offers an advanced usage for triggering recurr ...

  5. javascript ES5 Object对象

    原文:http://javascript.ruanyifeng.com/stdlib/object.html 目录 概述 Object对象的方法 Object() Object.keys(),Obje ...

  6. Learning JavaScript Design Patterns The Constructor Pattern

    In classical object-oriented programming languages, a constructor is a special method used to initia ...

  7. JavaScript Garden

    Objects Object Usage and Properties Everything in JavaScript acts like an object, with the only two ...

  8. JavaScript- The Good Parts Chapter 3 Objects

    Upon a homely object Love can wink.—William Shakespeare, The Two Gentlemen of Verona The simple type ...

  9. 【译】Javascript中的数据类型

    这篇文章通过四种方式获取Javascript中的数据类型:通过隐藏的内置[[Class]]属性:通过typeof运算符:通过instanceof运算符:通过函数Array.isArray().我们也会 ...

随机推荐

  1. 关于wav文件fft处理后x,y轴坐标数据的问题

    1.关于横坐标的频率的最大值是采样频率,那么每个点对应的频率值就很好算了:f(n) = [Fs/(N/2)]*n  (Fs是采样频率,常见的是44.1KHz(44100),N是采样点数,k表是第k个点 ...

  2. Spring Cloud 服务发现和消费

    服务的发现和消费 有了服务中心和服务提供者,下面我们来实现一个服务的消费者: 服务消费者主要完成两个任务——服务的发现和服务的消费,服务发现的任务是由Eureka客户端完成,而服务消费的任务是由Rib ...

  3. FMCW 雷达原理(转)

    FMCW(Frequency Modulated Continuous Wave),即调频连续波.FMCW技术和脉冲雷达技术是两种在高精度雷达测距中使用的技术.其基本原理为,发射波为高频连续波,其频率 ...

  4. NopCommerce 3.80框架研究(二) MVC 表示层与数据验证

    表示层框架结构 /Views/Shared/_Root.Head.cshtml /Views/Shared/_Root.cshtml /Views/Shared/_ColumnsOne.cshtml ...

  5. 谈谈bootstrap在实践中的应用

    bootstrap官网是http://www.bootcss.com/ bootstrap的CDN的网址是http://www.bootcdn.cn/ 在平时写的时候尽量用CDN,这样对于网站的运行效 ...

  6. http请求头和相应头的作用

    请求头(Request Headers) Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-L ...

  7. World Wind Java开发之三 显示状态栏信息(转)

    http://blog.csdn.net/giser_whu/article/details/40920315 先来看下本篇博客索要达到的效果: 找到源码下的gov.nasa.worldwind.ut ...

  8. java poi读取excel公式,返回计算值(转)

    http://blog.csdn.net/CYZERO/article/details/6573015 经测试,确实可以 1 package hrds.zpf.poi;  2  3  import o ...

  9. sparkSQL中udf的使用

    在Spark中使用sql时一些功能需要自定义方法实现,这时候就可以使用UDF功能来实现 多参数支持 UDF不支持参数*的方式输入多个参数,例如String*,不过可以使用array来解决这个问题. 定 ...

  10. Hybrid App开发之css样式使用

    前言: 前面学习了html,今天学习一下css的基本使用,看下html与css之间是如何结合来编写前端网页的. CSS 是什么? CSS 是 Cascading Style Sheets(级联样式表) ...