src/carbon-dating.js
/**
 * Determine the age of archeological find by using
 * given MODERN_ACTIVITY and HALF_LIFE_PERIOD values
 *
 * @param {String} sampleActivity string representation of current activity
 * @return {Number | Boolean} calculated age in years or false
 * in case of incorrect sampleActivity
 *
 * @example
 *
 * dateSample('1') => 22387
 * dateSample('WOOT!') => false
 *
 */
Determine the age of archeological find by using
given MODERN_ACTIVITY and HALF_LIFE_PERIOD values

@param {String} sampleActivity string representation of current activity
@return {Number | Boolean} calculated age in years or false
in case of incorrect sampleActivity

@example


Determine the age of archeological find by using given MODERN_ACTIVITY and HALF_LIFE_PERIOD values @param { String } sampleActivity string representation of current activity @return { Number | Boolean } calculated age in years or false in case of incorrect sampleActivity @example
function dateSample(sampleActivity) {
  let num = parseFloat(sampleActivity);
  const k = 0.693 / HALF_LIFE_PERIOD;
  if (typeof sampleActivity !== "string" || num <= 0 || num > 15 || Number.isNaN(num)) {
    return false;
  } else {
    return Math.ceil(Math.log(MODERN_ACTIVITY / num) / k);
  }
}
function dateSample ( sampleActivity ) { let num = parseFloat ( sampleActivity ) ; const k = 0.693 / HALF_LIFE_PERIOD ; if ( typeof sampleActivity !== "string" || num <= 0 || num > 15 || Number . isNaN ( num ) ) { return false ; } else { return Math . ceil ( Math . log ( MODERN_ACTIVITY / num ) / k ) ; } }
Determine the age of archeological find by using
 given MODERN_ACTIVITY and HALF_LIFE_PERIOD values
Determine the age of archeological find by using given MODERN_ACTIVITY and HALF_LIFE_PERIOD values
// throw new NotImplementedError('Not implemented'); // remove line with error and write your code here