File tree Expand file tree Collapse file tree 3 files changed +25
-31
lines changed Expand file tree Collapse file tree 3 files changed +25
-31
lines changed Original file line number Diff line number Diff line change 79
79
- dont-act-on-absent-elements
80
80
- optimize-selectors
81
81
- use-stylesheets-for-changing-css
82
- - variable-definition
83
82
- read-the-source
84
83
- code-organization :
85
84
- concepts
Original file line number Diff line number Diff line change 2
2
title : Syntax Basics
3
3
level : beginner
4
4
source : http://jqfundamentals.com/legacy
5
- attribution :
5
+ attribution :
6
6
- jQuery Fundamentals
7
7
---
8
8
@@ -75,3 +75,27 @@ var $my_AwesomeVariable = "d";
75
75
var _my_awesome_variable_$ = "e";
76
76
```
77
77
78
+ ### Variable definition
79
+
80
+ Variables can be defined using multiple ` var ` statements, or in a single
81
+ combined var statement.
82
+
83
+ ```
84
+ // this works
85
+ var test = 1;
86
+ var test2 = function() { ... };
87
+ var test3 = test2( test );
88
+
89
+ // and so does this
90
+ var test4 = 1,
91
+ test5 = function() { ... },
92
+ test6 = test2( test );
93
+ ```
94
+
95
+ Variables can be declared without assigning them a value. The value of a
96
+ variable declared without a value is ` undefined ` .
97
+
98
+ ```
99
+ var x;
100
+ x === undefined; // true
101
+ ```
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments