Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Conversion from CamelCase by ReeC
"use strict";
function fromCamelCase(name) {
return name.split(/(?=[A-Z])/g).join('_').toLowerCase();
}
var assert = require('assert');
if (!global.is_checking) {
console.log('Example:')
console.log(fromCamelCase('Name'))
// These "asserts" are used for self-checking and not for an auto-testing
assert.equal(fromCamelCase("MyFunctionName"), "my_function_name")
assert.equal(fromCamelCase("IPhone"), "i_phone")
assert.equal(fromCamelCase("ThisFunctionIsEmpty"), "this_function_is_empty")
assert.equal(fromCamelCase("Name"), "name")
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
June 14, 2018