$newUser.addClass(newTweet.user).attr('data-user', newTweet.user).text('@' + newTweet.user + ': ');
var user = $(this).data('user');
On line 1 newTweet is an object, but I don't understand the parameter 'data-user
. This isn't referenced in any of the other files, user
, so is the 'data-'
prefix performing some action? Or does it somehow reference line 2? Or am I completely wrong in both situations, I also don't understand how .addClass()
method is working in this situation. How does a property of an object get added as a class?