Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
open browser console to see results, jsbin console is useless here
</body>
</html>
 
function toLowerFirst(s) {
    return s.substr( 0, 1 ).toLowerCase() + s.substr( 1 );
}
function camelize(str) {
  return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) {
    return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
  }).replace(/\s+/g, '');
}
function test(name, func ){
  console.time(name);
  
  for(var i = 0; i < 1000; i++){
    func("Abcdefg");
  }
  
  console.timeEnd(name);
}
console.log(camelize('AbC'));
console.log(toLowerFirst('AbC'));
test('camelize', camelize);
test('toLower', toLowerFirst);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers