function sum(x, y = 5) {
// take sum
// the value of y is 5 if not passed
console.log(x + y);
}
sum(5); // 10
sum(5, 15); // 20
function multiply(a, b) {
b = (typeof b !== 'undefined') ? b : 1
return a * b
}
const increment = (number, value = 1) => number + value;
function sort(arr = [], direction = 'ascending') {
console.log('I'm going to sort the array', arr, direction)
}
sort([1, 2, 3])
sort([1, 2, 3], 'descending')
let func = (a, b = 2) => {
return a + b
}
const resultDisplayArray = [];
for(let i = 0; i < result.failure.length; i++) {
resultDisplayArray.push(`<li class="text-warning">${result.failure[i]}</li>`);
}