The Zen-javascript object of Programming (I.)

Source: Internet
Author: User

The artistic conception of Zen

Zen, it is necessary to understand the true meaning of the JavaScript technology, to reach the realm of understanding is not easy

The Zen of programming is a kind of realm, must put down the mentality, learns to lay down the quarrel, lays down the narrow viewpoint. To be optimistic and tolerant attitude towards all, to get the freedom of thought, programming Zen is to be happy programming, put down the technology itself, so as to obtain and create some new ideas and inspiration.

Introduction

The tangle of data and code

There are only two basic elements in the programming world: One is the code, the other is the data

Data is born quiet, always want to maintain their intrinsic nature, but the code is really lively, always want to change the world.

Code changes the data, but also because the resistance of the data will affect or change the original trend of the code

is in the data and code this contradictory and unified operation, always embodies the law of the computer World, and this law is the program logic we write


Body

JavaScript data is simple, only null,undefined,boolean,string,number, complex data only one, is the object
Just like the Chinese naïve materialism the elements of the world into Kanagi and fire soil.
Only one form of expression is function.

varLife = {} for(life.age=1; life.age<=3; life.age++){Switch(life.age) { Case1: Life.body= ' egg '; Life.say=function() {Alert ( This. Age + This. Body)} Break Case2: Life.tail= ' Tail '; Life.gill= ' Gill '; Life.body= ' tadpoles '; Life.say=function() {Alert ( This. Age + This. Body + '-' + This. Tail + This. Gill)} Break Case3:DeleteLife.tail;DeleteLife.gail;life.lung= ' lungs '; Life.legs= ' Four legs '; Life.body= ' Frog '; Life.say=function() {Alert ( This. Age + This. Body + '-' + This. Lung + This. Legs)} Break}life.say ()}

Small tadpoles find mother, then we need class? Class from scratch, and disappear and invisible, and the object into one, it is because the concept of the class put down, JavaScript has more vitality
If you have a sense of it, it means that you have gradually understood the Zen of JavaScript.

Zen-javascript object of Programming (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.