Untitled

Run Settings
LanguageJavaScript
Language Version
Run Command
// Array as a data structure with its time complexcity or Big O const string = ['a', 'b', 'c', 'd'] // this array use 4*4 = 16 byte of memory //push //push help to add data on the end of an array string.push('e') // O(1) //pop //pop help to remove the last item of an array string.pop() //O(1) //unshift //unshift help to add item on the first index of an array //it first shift the entire array with one position an add item on the first item index string.unshift('x') // O(n) bcoz it shift the entire array first //splice //splice helps to add data on the middle of the array or wherever you want //splice first argument is for the position where we want to add item //splice second argument is for delete any item 0 if not needed //splice thired argument is for the item which need to add string.splice(2, 0, 'mithu') // O(n) console.log(string)
// Array as a data structure with its time complexcity or Big O const string = ['a', 'b', 'c', 'd'] // this array use 4*4 = 16 byte of memory //push //push help to add data on the end of an array string.push('e') console.log(string)
Editor Settings
Theme
Key bindings
Full width
Lines