What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-27 18:30:09
validar si un numero es par javascript map
// Return a new array where even numbers are multiplied by 2 let arr = [1, 2, 3, 4, 5, 6, 7] function consoleEven(arr) { let data = arr.map((num) => (num % 2 === 0 ? num * 2 : num * 1)) console.log(data) // [1, 4, 3, 8, 5, 12, 7] } // ? is... Add solution -
Javascript 2021-10-01 04:15:03
js array Categorize New Member
function openOrSenior(data){ // using map and ternary operator. return data.map( x => x[0] >= 55 && x[1] > 7 ? "Senior" : "Open"); } console.log(openOrSenior([[45, 12],[55,21],[19, -2],[104, 20]])); //,['Open', 'S... Add solution -
C# 2021-09-03 07:25:01
ternary operator in c#
/* In C#, if condition is true, the first expression is evaluated and becomes the result; if false, the second expression is evaluated and becomes the result. */ // The syntax of ternary operator is: Condition ? Expression1 : Expression2; // Here... Add solution