JSFiddle - React, Tailwind, and code Playground

by 3rror404

JavaScript

var arrQuestions = [
	{
  	'Title': 'Test 1',
    'WillingAbleCount': 3
  },
  {
  	'Title': 'Test 2',
   	'WillingAbleCount': 1
  },
  {
  	'Title': 'Test 3',
   	'WillingAbleCount': 2
  },
  {
  	'Title': 'Test 4',
   	'WillingAbleCount': 4
  },
  {
  	'Title': 'Test 5',
   	'WillingAbleCount': 4
  }
];

arrQuestions.sort((a,b) => (a.WillingAbleCount < b.WillingAbleCount) ? 1 : ((b.WillingAbleCount < a.WillingAbleCount) ? -1 : 0));

console.log(arrQuestions);

setTimeout(function() {
	arrQuestions = arrQuestions.splice(0, 3);

	console.log(arrQuestions);
}, 0)