Skip to content

Commit 668ee1c

Browse files
committed
Move content about using jQuery for type checking into javascript-101\types. Resolves #91
1 parent eddb7fc commit 668ee1c

File tree

10 files changed

+21
-1053
lines changed

10 files changed

+21
-1053
lines changed

content/javascript-101/types.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,28 @@ alert(foo.length);
161161

162162
There are many more methods for manipulating arrays, details can be found on the [MDN Document](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array "MDN - Array Reference")
163163

164+
## Type Checking With jQuery
164165

166+
jQuery offers a few basic utility methods for determining the type of a
167+
specific value.
168+
169+
<javascript caption="Checking the type of an arbitrary value">
170+
var myValue = [1, 2, 3];
171+
172+
// Using JavaScript's typeof operator to test for primative types
173+
typeof myValue == 'string'; // false
174+
typeof myValue == 'number'; // false
175+
typeof myValue == 'undefined'; // false
176+
typeof myValue == 'boolean'; // false
177+
178+
// Using strict equality operator to check for null
179+
myValue === null; // false
180+
181+
// Using jQuery's methods to check for non-primative types
182+
jQuery.isFunction(myValue); // false
183+
jQuery.isPlainObject(myValue); // false
184+
jQuery.isArray(myValue); // true
185+
</javascript>
165186

166187

167188

content/jquery-basics/attributes.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

content/jquery-basics/css-styling-dimensions.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

content/jquery-basics/document-ready.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

content/jquery-basics/exercises.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)