find by value

by John Wick

JavaScript

var REMIND_AVAILABLE = [
  '30 minutes',
  '1 hour',
  '3 hours',
  '6 hours',
  '12 hours',
  '1 day',
  '36 hours',
  '2 days',
  '3 days',
  '2 weeks'
];


/**
 * Finds and returns a specific value in the REMIND_AVAILABLE array.
 * @param {string} search - The value to search for in the array.
 * @returns {string|null} - The value if found, or null if not found.
 */
function findInRemindAvailable(search) {
  return REMIND_AVAILABLE.includes(search) ? search : null;
}

// Example usage:
var search = '6 hours';
var result = findInRemindAvailable(search);
console.log(result); // Output: '6 hours'