Answers for "js array Categorize New Member"

0

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', 'Senior', 'Open', 'Senior'])
console.log(openOrSenior([[3, 12],[55,1],[91, -2],[54, 23]])); //,['Open', 'Open', 'Open', 'Open'])
console.log(openOrSenior([[59, 12],[55,-1],[12, -2],[12, 12]])); //,['Senior', 'Open', 'Open', 'Open'])
Posted by: Guest on April-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language