- 浏览: 651816 次
- 性别:
- 来自: 淮安
文章分类
- 全部博客 (260)
- Java (0)
- vim (9)
- python (86)
- AdobePDF (2)
- mysql (10)
- Emacs (12)
- JavaScript (18)
- postgresql (2)
- windows (4)
- Eclipse (1)
- debian (4)
- 浏览器 (2)
- html (1)
- rhel (1)
- Linux (4)
- SVN (2)
- Ruby (30)
- ERP (8)
- my_linux_config (2)
- C++ (2)
- CentOS (5)
- Ubuntu (12)
- httpd (3)
- nginx (1)
- CSS (1)
- Agile (1)
- C (3)
- Redmine (2)
- 面试题 (1)
- 收集 (7)
- 架构 (1)
- 服务器 (2)
- logarithms (1)
- 数学 (1)
最新评论
-
hymzjsw:
python 变量命名规范 -
IWSo:
...
mysql #1170错误(42000) BLOB/TEXT Column Used in Key Specification Without a Key Le -
wl59138528:
由于Python臭名昭著的GIL问题,OpenERP 6.1以 ...
OpenERP 部署环境使用说明 -
greybeard:
xiaoyao3857 写道怎么看着一大堆,似乎中间有些东西重 ...
python 变量命名规范 -
xiaoyao3857:
怎么看着一大堆,似乎中间有些东西重复说了吧
python 变量命名规范
1. JS is a high-level, dynamic, untyped interpreted programming
language that is well-suited to object-oriented and functional
programming styles.
2.
3. Two other very important types that JavaScript programs can
manipulate are objects and arrays.
4.
5.
language that is well-suited to object-oriented and functional
programming styles.
2.
// variable is a symbolic name for a value. var x; // Declar a variable named x. x = 0; x x = 1; x = 0.01; x = "hello world"; x = 'JavaScript'; x = true; // Boolean values. x = false; x = null; // Null is a special value that means "no value". x = undefined; // Undefined is like null.
3. Two other very important types that JavaScript programs can
manipulate are objects and arrays.
// JavaScript's most important data type is the object. // An object is a collection of name/value pairs, or a string to // value map. var book = { // Objects are enclosed in curly braces. topic: "JavaScript", // The property "topic" has value "JavaScript". fat: true // The propery "fat" has value true. }; // Access the properties of an object with . or[]: book.topic // => "JavaScript" book["fat"] // => true: another way to access property values. book.author = "Flanagan"; // Create new properties by assignment. book.contents = {}; // {} is an empty object with no properties. // JavaScript also supports arrays (numerically indexed lists) of values: var primes = [2. 3, 5, 7]; // An array of 4 values, delimited with [ and ]. primes[0] // => 2: the first element (index 0) of the array. primes.length // => 4: how many elements in the array. primes[primes.lenght-1] // => 7: the lastelement of the array. primes[4] = 9; // Add a new element by assignment. primes[4] = 11; // Or alter an existing element by assignment. var empty = []; // [] is an empty array with no elements. empty.lenght // => 0 // Arrays and objects can hold other arrays and objects: var points = [ // An array with 2 elements. {x:0, y:0}, // Each element is an object {x:1, y:1} ]; var data = { // An object with 2 properties trial1: [[1,2], [3,4]], // The value of each property is an array. trial2: [[2,3], [4,5]] // The elements of the arrays are arrays. };
4.
// Operators act on values (the operands) to produce a new value. // Arithmetic operators are the most common: 3 + 2 // => 5: additon 3 - 2 3 * 2 3 / 2 points[1].x - points[0].x // => 1: more complicated operands work, too "3" + "2" // => "32": + adds numbers, concatenates strings // JavaScript defines some shorthand arithmetic operators var count = 0; // Define a variable count++; // Increment the variable count--; // Decrement the variable count += 2; // Add 2: same as count = count + 2; count *= 3; // Multiply by 3: same as count = count * 3; count // => 6: variable names are expressions. too // Equality and relational operators test whether two values are equal, // unequal, less than, greater than, and so on. They evaluate to true or false. var x = 2, y = 3; // These = signs are assignment, not equality tests x == y // => false: equality x != y // => true: inequality x < y // => true: less-than x <= y x > y "two" == "three" // => false: the two strings are different "two" > "three" // => true: "tw" is alphabetically greater than "th" false == (x > y) // => true: false is equal to false // Logical operators combine or invert boolean values (x == 2) && (y == 3) // => true: both comparisons are true. && is AND (x > 3) || (y < 3) // => false: neither comparison is true. || is or !(x == y) // => true: ! inverts a boolean value
5.
// Functions are parameterized blocks of JavaScript code that we can invoke. function plus1(x) { // Define a function named "plus1" with parameter "x" return x+1; // Return a value one larger than the value passed in } // Functions are enclosed in curly braces plus1(y) // => 4: y is 3, so this invocation returns 3+1 var square = function(x) { // Functions are values and can be assigned to vars return x*x; // Compute the function's value }; // Semicolon marks the end of the assignment. square(plus1(y)) // => 16: invoke two functions in one expression
发表评论
-
JavaScript ---- 示例(十进制转换为二进制)
2012-01-17 23:15 3920<html> <head> ... -
JavaScript ---- Type Conversions
2012-01-16 23:27 1114JavaScript is very flexible abo ... -
JavaScript ---- Wrapper Objects
2012-01-14 23:41 1241We've also seen that strings ha ... -
JavaScript ---- The Global Object
2012-01-14 23:41 10401. The global object is a regul ... -
JavaScript ---- null VS undefined
2012-01-14 23:41 1034共同点: 1, null and undefined both ... -
JavaScript-----需要留心之处
2012-01-06 10:55 8141. === if (o !== null) ... -
JavaScript ---- Core constructor
2012-01-06 08:27 10691, Date var then = new Date( ... -
JavaScript----数字, 字符串, 布尔类型
2012-01-06 00:51 11281. 数字类型(numbers) 1.1 javascr ... -
JavaScript----变量
2012-01-06 00:21 7331. JavaScript变量是无类型的(untyped) ... -
JavaScript ---- Types
2012-01-05 16:14 8421. JavaScript types can be divi ... -
JavaScript ---- All Literals
2011-12-30 10:43 70012 // The ... -
JS类似命名空间制作
2011-11-30 10:26 1051// 创建一个默认的,全局的命名空间 var YAHOO ... -
JS继承
2011-11-30 09:44 11521. 原型式继承 // ... -
JS重要的地方
2011-11-30 09:14 889在JavaScript里,作用域是由函数划分的,而不是由块(b ... -
Preface
2011-11-24 09:48 967This book is divided into four ... -
JS 对象
2011-11-23 17:53 13161. JavaScript的简单类型包括数字,字符串,布尔值( ... -
JavaScript 基础语法
2011-11-19 11:25 10391. JavaScript 只有一个单一的数字类型。它在内部被 ...
相关推荐
Chapter 1 Introduction to JavaScript Core JavaScript Chapter 2 Lexical Structure Chapter 3 Types, Values, and Variables Chapter 4 Expressions and Operators Chapter 5 Statements Chapter 6 Objects ...
Chapter 1 Introduction to JavaScript Core JavaScript Chapter 2 Lexical Structure Chapter 3 Types, Values, and Variables Chapter 4 Expressions and Operators Chapter 5 Statements Chapter 6 Objects ...
Comprehensively updated to cover ECMAScript 6 and modern JavaScript development, the second edition of this step-by-step introduction to coding in JavaScript will show you how to to solve real-world ...
Chapter 1: Introduction To Javascript And The Web Chapter 2: Data Types And Variables Chapter 3: Decisions And Loops Chapter 4: Functions And Scope Chapter 5: Javascript-An Object-Based Language ...
Chapter 12 Introduction to NumPy Chapter 13 Introduction to Pandas Chapter 14 Cleaning Data with Pandas Chapter 15 Visualizing Data with Matplotlib Chapter 16 Exploring Data with Pandas Chapter 17 ...
JavaScript lies at the heart of almost every modern web application, from social apps to the newest browser-based games. Though simple for beginners to pick up and play with, JavaScript is a flexible,...
Chapter 1 Introduction To Build First Chapter 2 Composing Build Tasks And Flows Chapter 3 Mastering Environments And The Development Workflow Chapter 4 Release, Deployment, And Monitoring Part 2 ...
Chapter 3 Introduction to CSS3 Chapter 4 Meta Tags and Media Queries Chapter 5 HTML5 Mobile Apps with PhoneGap Chapter 6 HTML5 Media and Device Access Chapter 7 Design, Debug, and Test Mobile Apps ...
By bringing the advantages of ReactJS to mobile, React Native transforms every web developer into a...Chapter 1. Introduction Chapter 2. Getting Started Chapter 3. Components for Mobile Chapter 4. Styles
Introduction to JavaScript D22. Using JavaScript Part V. Web lmages D23. Web lmage Basics D24. Image Asset Production D25. SVG Part Vl. Appendices A. Answers B. HTML5 Global Attributes C. CSS ...
Chapter 1. Introduction to MVC Chapter 2. Introduction to Bootstrap Chapter 3. Introduction to Knockout.js Chapter 4. Working with a Database Part II. Working with Data Chapter 5. Listing, Sorting, ...
Chapter 1is a quick introduction to JavaScript that describes what it is and where it came from. Chapter 2explains what JavaScript is good for, outlining what you can do with it. Chapter 3lets me get...
Chapter 1. Variables: Declaration, Definition and Type Chapter 2. Controls: Booleans, Branch and Loops Chapter 3. Data: Numbers and Strings Chapter 4. Objects and Prototypes Chapter 5. Arrays Chapter...
JavaScript for Kids is a lighthearted introduction that teaches programming essentials through patient, step-by-step examples paired with funny illustrations. You’ll begin with the basics, like ...