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. Vue小贴士

    1.去掉空格影响,删除掉此段代码 2.想要同时运行两个Vue项目,修改端口号,黄色框内的内容自己随意改个端口号就行,比如:8082 3.批处理  在项目的根目录中添加a.bat文件,这样就可以在运行的 ...

  2. springMvc-视图模型封装及注解参数

    1.视图模型封装,ModelAndView可以向页面返回视图的同时吧模型也传入页面 2.注解参数,springMvc很好的地方在于简单,高效,@RequestParam注解能非常好的取得页面参数 代码 ...

  3. HDU 2191 悼念汶川地震(多重背包)

    思路: 多重背包转成01背包,怎么转?把一种大米看成一堆单个的物品,每件物品要么装入,要么不装.复杂度比01背包要大.时间复杂度为O(vns)(这里S是所有物品的数量s之和).这个做法太粗糙了,但就是 ...

  4. C++指针的概念解读

    C++指针的概念解读 超详细 指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址.要搞清一个指针需要搞清指针的四方面的内容:指针的类型,指针所指向的类型,指针的值或者叫指针所指向的内存区 ...

  5. 知名nodeJS框架Express作者宣布弃nodeJS投Go

    知名 nodeJS 框架 Express 的作者 TJ Holowaychuk 在 Twitter 发推并链接了自己的一篇文章,宣布弃 nodeJS 投 Go. 他给出的理由是:Go 语言和 Rust ...

  6. vuejs里面v-if,v-show和v-for

    <div id='root'> <div v-if='show'>helle world</div> <button @click='handleClick' ...

  7. 机器学习中正则化项L1和L2的直观理解

    正则化(Regularization) 概念 L0正则化的值是模型参数中非零参数的个数. L1正则化表示各个参数绝对值之和. L2正则化标识各个参数的平方的和的开方值. L0正则化 稀疏的参数可以防止 ...

  8. AngularJS 字符串

    AngularJS字符串就像是JavaScript字符串 <!DOCTYPE html><html><head><meta http-equiv=" ...

  9. strong和weak

    ios中使用ARC后,内存管理使用了新的关键字:strong(强引用) 和 weak(弱引用),默认是strong引用 strong: 使用strong类型指针指向的对象,会一直保持指向,直到所有st ...

  10. node的webserver模板

    const express = require('express'); const swig =require('swig'); const fs = require('fs'); //创建服务器 c ...