docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a utility that converts between different units of measurement and finds the best unit representation for values.
/**
* Converts a value from one unit to another.
*
* @param {number|string} value - The value with original unit (e.g., "1000 m")
* @param {string} targetUnit - The target unit to convert to (e.g., "km")
* @returns {number|string} The converted value with the target unit
*/
function convertUnit(value, targetUnit) {
// IMPLEMENTATION HERE
}
/**
* Converts a value to the best fitting unit with appropriate prefix.
*
* @param {number|string} value - The value with original unit (e.g., "5000 m")
* @returns {number|string} The value in the most appropriate unit
*/
function toBestUnit(value) {
// IMPLEMENTATION HERE
}
module.exports = {
convertUnit,
toBestUnit
};Provides unit conversion and mathematical operations support.