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. java关于类的构建

    一开始老是把类的构建和代码的重构搞的混淆,现在理解的可能还好点(至少概念上不会出错了),简单的说类就是一个复杂的变量,这个变量里面含有属性.方法和构造方法,注意方法和构造方法是完全不同的两个概念,而且 ...

  2. vim常用命令大全

    在命令状态下对当前行用== (连按=两次), 或对多行用n==(n是自然数)表示自动缩进从当前行起的下面n行.你可以试试把代码缩进任意打乱再用n==排版,相当于一般IDE里的code format.使 ...

  3. vue实现选中列表功能

    <template> <div> <ul v-for="prop in items"> <dt>{{prop.name}}</ ...

  4. 构建第一个spring boot2.0应用之项目启动运行的几种方式(二)

    方法一. 配置Run/Debug Configuration  选择Main Class为项目 Application启动类(入口main方法) (2).进行项目目录,即包含pom.xml的目录下,启 ...

  5. Android中渐变图片失真的解决方案

    在android开发(尤其是android游戏开发)中有一个很严重的问题就是带有渐变效果的png图片会出现严重的banding(色带),鉴于这种情况,有几种可行的解决方法:   1.如果Activit ...

  6. 【迷你微信】基于MINA、Hibernate、Spring、Protobuf的即时聊天系统:10.项目介绍之架构(2)

    欢迎阅读我的开源项目<迷你微信>服务器与<迷你微信>客户端 前言 前面我们讲到<迷你微信>服务器端的主架构,现在我们来描述一下它的模块详细信息. 网络模块 从上图我 ...

  7. GitLab-CE-8.9.4 (OpenLogic CentOS 7.2)

    平台: CentOS 类型: 虚拟机镜像 软件包: gitlab-8.9.4 bug tracking collaboration commercial development devops git ...

  8. java Vamei快速教程03 构造器和方法重载

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 在方法与数据成员中,我们提到,Java中的对象在创建的时候会初始化(initial ...

  9. POJ 3281 Dining(网络流最大匹配)

    分析: 数学模型是三个集合A,B,C,(a,b,c)构成一个匹配.因为图一个点只能匹配一次,把a拆点a',a", 在可以匹配的点上连边,s - b - a' - a" - c - ...

  10. Feign + Hystrix 服务熔断和服务降级

    本机IP为  192.168.1.102 1.    新建 Maven 项目   feign 2.   pom.xml <project xmlns="http://maven.apa ...