underscore-observe icon indicating copy to clipboard operation
underscore-observe copied to clipboard

Observe event not triggering when using a string as array index

Open dhanendrannewscorp opened this issue 7 years ago • 0 comments

create event isn't been triggered when we using a string for an Array index.

E.g:

var myArr = [
    'a' => 'a'
];

_.observe( myArr, 'create', function( item, index ) {
    console.log( 'tada' );
} );

myArr['b'] = 'b'; // Noting happens

myArr[0] = 'c'; // tada printed on the console

dhanendrannewscorp avatar Aug 14 '17 13:08 dhanendrannewscorp