array.push in Javascript not working

arrays, javascript, push

Solution

Change

conversations.push = (jQuery(this).attr("data-conversationid"));

To

conversations.push( jQuery(this).attr("data-conversationid") );

`Array.push()` is a function call and not an assignment.

Problem

``` var conversations = new Array(); jQuery('.CChatWindow').each(function(){ if (jQuery(this).is(":visible") && jQuery(this).attr("data-conversationid") != 0) { alert(jQuery(this).attr("data-conversationid")); // returns 1 and 2 conversations.push = (jQuery(this).attr("data-conversationid")); } }); alert(conversations); // returns an empty string ``` Whats the problem with my code? array.push does not seem to work. Thanks!

Original source