cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <script src='https://scottdalessandro.github.io/jasmine-total/js/jasmine-suite.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<div class='container-fluid'>
  <!-- Nav tabs -->
  <ul class="nav nav-tabs" id="myTab" role="tablist">
    <li class="nav-item">
      <a class="nav-link active" data-toggle="tab" href="#problem" role="tab">Challenge & Examples</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-toggle="tab" href="#testspecs" role="tab">Test Specs</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-toggle="tab" href="#run-specs" role="tab">Run Specs</a>
    </li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div class="tab-pane active" id="problem" role="tabpanel">
      <div class='jumbotron' id="probjumbo">
      </div>
    </div>
    <div class="tab-pane" id="testspecs" role="tabpanel">
      
      <h4>SPECS </h4>
      <pre> 
        <code id="codeblock" class="language-javascript"> 
        </code> 
      </pre>
     
    </div>
    <div class="tab-pane" id="run-specs" role="tabpanel">

    </div>
  </div>

</div>


<script id="test-data">
/*
STARTPROBLEM
## Underscore to CamelCase


Write a function to convert a variable name from under_score format to camelCase. 


Make sure you support an unlimited number of underscores in the input!  You will not have to worry about white space in your input, only alphanumeric characters and underscores.


#### Background Info


Different programming languages use different ways of formatting the names of their variables. For example, some separate words with underscores (i_am_a_function_name). Others, including JavaScript, separate the words inside a variable name by capitalizing the first letter of each new word. This convention is called camel case (iAmAFunctionName). Note that in camelcase, the first word is not capitalized!


**Examples**:


- **INPUT**: `underToCamel("first_name");`
- **OUTPUT**: `"firstName"`



- **INPUT**: `underToCamel("my_income_tax_from_2015");`
- **OUTPUT**: `"myIncomeTaxFrom2015"`

```


ENDPROBLEM
*/       
 
/// STARTSPECS
describe('underToCamel', function() {
  it('returns a string value', function() {
    expect(typeof underToCamel('hello_world')).toEqual('string');
  });

  it("doesn't change a plain string", function() {
    expect(underToCamel('netflix')).toEqual('netflix');
    expect(underToCamel('hulu')).toEqual('hulu');
    expect(underToCamel('youtubeTV')).toEqual('youtubeTV');
  });

  it('removes the one underscore and capitalizes the proceeding character of the underscore', function() {
    expect(underToCamel('accident_prone')).toEqual('accidentProne');
    expect(underToCamel('camera_ready')).toEqual('cameraReady');
    expect(underToCamel('quick_thinking')).toEqual('quickThinking');
  });

  it('removes multiple underscores and captilized the next character after each underscore', function() {
    expect(underToCamel('i_am_going_skateboarding')).toEqual('iAmGoingSkateboarding');
    expect(underToCamel('what_are_you_up_to')).toEqual('whatAreYouUpTo');
    expect(underToCamel('intelligent_quick_thinking')).toEqual('intelligentQuickThinking');
  });
});
/// ENDSPECS
</script>

<script>


   
    var testData = document.getElementById("test-data").innerHTML;
    var probData = [], specData = [];
    var insideProb = false, insideSpec = false;

    testData.split(/\n/).forEach(line => {
      if(line.indexOf("STARTPROBLEM") >= 0) {
        insideProb = true;
      } else if(line.indexOf("ENDPROBLEM") >= 0) {
        insideProb = false;
      } else if(line.indexOf("STARTSPECS") >= 0) {
        insideSpec = true;
      } else if(line.indexOf("ENDSPECS") >= 0) {
        insideSpec = false;
      }
      if(insideProb) { probData.push(line) };
      if(insideSpec) { specData.push(line) };
    });

    probHTML = marked(probData.slice(1).join("\n"));
    document.getElementById("probjumbo").innerHTML = probHTML;  
    specHTML = "\n" + specData.slice(1).join("\n");
    document.getElementById("codeblock").innerHTML = specHTML;  

    $(document).ready(function() { 
      document.getElementById('run-specs').appendChild(document.getElementsByClassName('jasmine_html-reporter')[0]);
    });


</script>
            
          
!
            
              /* Write Code Here */










//EXAMPLE TESTS

console.log(underToCamel("first_name"));
//OUTPUT: "firstName"

console.log(underToCamel("my_income_tax_from_2015"));
//OUTPUT: "myIncomeTaxFrom2015"
            
          
!
999px
Loading ..................

Console