Added manipulating arrays functions in JavaScript