Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear&Readable solution in Clear category for [old] Conversion into CamelCase by SaintDron
"use strict";
function toCamelCase(name) {
return name.split('_')
.map( s => s[0].toUpperCase() + s.slice(1) )
.join('');
}
var assert = require('assert');
if (!global.is_checking) {
console.log('Example:')
console.log(toCamelCase('name'))
// These "asserts" are used for self-checking and not for an auto-testing
assert.equal(toCamelCase("my_function_name"), "MyFunctionName")
assert.equal(toCamelCase("i_phone"), "IPhone")
assert.equal(toCamelCase("this_function_is_empty"), "ThisFunctionIsEmpty")
assert.equal(toCamelCase("name"), "Name")
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
March 26, 2018
Comments: