0

I'm quite new to Javascript and I feel like I am missing something about assignments. I have a variable "users" of type "SQLResultSetRowList" which is actually the result of a SELECT SQL request and that represents the users of my application (I'm working with Phonegap if that's of any relevance).

When I do

users.item(0).name = "foo";

It doesn't actually change the property name of my first user to "foo", it remains the same. It also returns "foo" (which is normal I think).

I found a solution that consist in "copying" the object

var newObj = {id: users.item(0).id, ... , name: users.item(0).name};
newObj.name = "foo";

but it feels really dirty. Could you tell me what I am doing wrong?

Thanks in advance.

Bert.e
  • 107
  • 2
  • 13

0 Answers0