shreyaskudav Posted July 4, 2011 Share Posted July 4, 2011 What is the difference between a STRING and an OBJECT? Link to comment Share on other sites More sharing options...
brucemand Posted July 4, 2011 Share Posted July 4, 2011 What is the difference between a STRING and an OBJECT?i suggest you "go to school" first !start here and work your way to the bottom of the list.don't quote me on this as proper def-n, but a STRING is a set of characters that is used as data, not the variables or functions, methods, etcan OBJECT is, ehm... the KEY "thing" you're dealing with in HTML/JS - read through that link, and you'll see what it is more clearly. Link to comment Share on other sites More sharing options...
Ingolme Posted July 4, 2011 Share Posted July 4, 2011 The W3Schools Javascript tutorial explains what a string is http://www.w3schools.com/js/js_obj_string.asp and what an object is http://www.w3schools.com/js/js_obj_intro.aspThe difference? Well, they are hardly related to eachother in any way, besides being a data type. Link to comment Share on other sites More sharing options...
jeffman Posted July 4, 2011 Share Posted July 4, 2011 In JavaScript, everything is an object. The value of a string object is a series of characters, but the object also has properties and methods. In other languages, a string is only the characters.A string object is different from objects you create yourself in a very special way. When you write str = "hello", only the characters are overwritten. The methods and properties still exist (although the value of some properties, such as length, would be updated).This would not happen if you created a generic object and assigned a new value to it. In that case, all the objects properties and methods would be overwritten. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.