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. 介绍一个很好用的Rsa加解密的.Net库 Kalix.ApiCrypto

    Rsa非对称加密技术 这个就不说了,大家上网搜索都知道,公钥加密,私钥解密.当然大家也可以自己实现.这里就懒了,就去找一个现成的库,Nuget上搜索,GitHub上搜索,发现.Net的加解密库,下载量 ...

  2. bootstrapTable的数据后端分页排序

    数据后端分页排序,其实就是sql语句中oeder by做一些限制. 之前在写sql语句中的order by是写死,既然要写活,就要传参数到后台. 之前讲到bootstrapTable的queryPar ...

  3. DB2常用函数详解

    (一) 字符串函数 VALUE函数  语法:VALUE(EXPRESSION1,EXPRESSION2) VALUE函数是用返回一个非空的值,当其第一个参数非空,直接返回该参数的值,如果第一个参数为空 ...

  4. Windows8 64位运行Silverlight程序不能访问WCF的解决方案

    公司的项目是Silverlight+WCF,而我的本本是Win8 64位系统,一直无法正常运行Silverlight程序,一个同事找到了方案,现分享出来 一种情况是,Vs2010运行程序时,报无法加载 ...

  5. 一、基于Qt的图像矩形区域改色

    Qt环境下图像的打开和涂色 一.设计目标 能够在 Qt QtCreator 环境下打开常用图像格式文件,诸如 bmp.jpg.png 图像等,然后将他们转化为 Qt 中的 QImage 类,并进行矩形 ...

  6. Mysql数据库学习总结(一)

    数据库概念 数据库(Database)是按照数据结构来组织.存储和管理数据,建立在计算机存储设备上的仓库. 简单说,数据库就是存放数据的仓库.和图书馆存放书籍.粮仓存放粮食类似. 数据库分类 分为 关 ...

  7. Jsoup进阶选择器

    package com.open1111.jsoup; import org.apache.http.HttpEntity;import org.apache.http.client.methods. ...

  8. LeetCode Minimum Depth of Binary Tree 找最小深度(返回最小深度)

    题意:找到离根结点最近的叶子结点的那一层(设同一层上的结点与根结点的距离相等),返回它所在的层数. 方法有: 1.递归深度搜索 2.层次搜索 方法一:递归(无优化) /** * Definition ...

  9. JS中的toString()和valueOf()方法

    1.toString()方法:主要用于Array.Boolean.Date.Error.Function.Number等对象转化为字符串形式.日期类的toString()方法返回一个可读的日期和字符串 ...

  10. [VC]vc中socket编程步骤

    sockets(套接字)编程有三种,流式套接字(SOCK_STREAM),数据报套接字(SOCK_DGRAM),原始套接字(SOCK_RAW): 基于TCP的socket编程是采用的流式套接字.在这个 ...