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)