The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
indexOfmethod returns the first index at which a given element can be found in the array, or -1 if it is not present. Counting starts with 0.
let systems = ['Debian', 'Ubuntu', 'Mint']; let i1 = systems.indexOf('Mint'); let i2 = systems.indexOf('Windows');
i1gets the value
i2gets the value
-1. For a complete reference see MDN web docs.
addthat adds an element to the end of an array. However, the element should only be added if it is not already in the array.
add([1, 2], 3)should return
[1, 2, 3]and
add([1, 2], 2)should return