Strings
and Objects
STRING
“...”
var str_var = “...”
str_var.length
startsWith(str)
&
endsWith (str)
&
indexOf (str, pos)
&
lastIndexOf (str, pos)
split(separator)
&
contains(str)
&
substr(s...
OBJECT
{}
var obj_var = {}
var obj_var = {
prop_name : “prop”,
method_name : function () {
// method name
}
}
obj_var. prop_name
obj_var[‘prop_name’]
obj_var. method_name()
obj_var[‘method_name’]()
this
var obj_var = {
prop_name : “prop”,
method_name : function () {
console.log( this.prop_name )
}
}
window
var prop_name = “data”;
var obj_var = {
prop_name : “prop”,
method_name : function () {
console.log(prop_name );
}
}
Primitive vs Reference Type
Data Wraper Utility
Object
Array
Function
Boolean
Number
String
Math
Date
RegExp
Upcoming SlideShare
Loading in …5
×

strings and objects in JavaScript

479 views
447 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
479
On SlideShare
0
From Embeds
0
Number of Embeds
251
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

strings and objects in JavaScript

  1. 1. Strings and Objects
  2. 2. STRING
  3. 3. “...”
  4. 4. var str_var = “...”
  5. 5. str_var.length
  6. 6. startsWith(str) & endsWith (str) & indexOf (str, pos) & lastIndexOf (str, pos) split(separator) & contains(str) & substr(start, len) & substring(start, end)
  7. 7. OBJECT
  8. 8. {}
  9. 9. var obj_var = {}
  10. 10. var obj_var = { prop_name : “prop”, method_name : function () { // method name } }
  11. 11. obj_var. prop_name
  12. 12. obj_var[‘prop_name’]
  13. 13. obj_var. method_name()
  14. 14. obj_var[‘method_name’]()
  15. 15. this
  16. 16. var obj_var = { prop_name : “prop”, method_name : function () { console.log( this.prop_name ) } }
  17. 17. window
  18. 18. var prop_name = “data”; var obj_var = { prop_name : “prop”, method_name : function () { console.log(prop_name ); } }
  19. 19. Primitive vs Reference Type
  20. 20. Data Wraper Utility Object Array Function Boolean Number String Math Date RegExp

×