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.
Arrays
Arrays are objects for storing multiple values. Arrays are preferably created with square brackets.
let languages = ['C', 'C++', 'Java'];
let primes = [2, 3, 5, 7, 11];
let emptyArray = [];
let a = 'Douglas';
let b = 12;
let c = true;
let someValues = [a, b, c];
Exercise
Write a function
Example:
toArray
that takes 2 values and returns these values in an array.Example:
toArray(5, 9)
should return the array [5, 9]
.
+ Hint
function toArray(a, b) {
return [...];
}
+ Solution
function toArray(a, b) {
return [a, b];
}