Skip to content

Instantly share code, notes, and snippets.

@ahmadajmi
Created March 24, 2011 08:34
Show Gist options
  • Save ahmadajmi/884746 to your computer and use it in GitHub Desktop.
Save ahmadajmi/884746 to your computer and use it in GitHub Desktop.
Strings are immutable
var str = "foo"; // Literal String
str.replace('f', 'o'); // Modified the string
str; // return "foo" not "ooo"
// similar strings are equal
var s = "abc";
var d = "abc";
d == d; // return true
// String methods like charAt, indexOf
var s = "foo";
s.charAt(0); // return "f"
s.indexOf("f"); // return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment