Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p>hi, this is a 3rd test</br>
  <script>
    var sum = 0;
    function addSum(num) {
    sum += num;
    document.write("num= " + num);
    document.write(" , sum= " + sum + "</br>");
    //return num; //With this it's fixed.
    }
    //console.log("This is a test"); //didn't work :(
    document.write("This is a second test: ");
    document.write("Result of addSum= " + addSum(3) + "</br></br>");
    document.write("</br>Result of 2nd addSum= " + addSum(1));

    document.write("</br></br>So this means the following :</br>A function always has a return value, even if not stated in a statement.</br>When a function is called and has no return value, the function processes the inner code but the returned value is 'undefined'.");
    document.write("</br>(^_^)");
  </script>
</p>

<!-- ----- -----  ----- ----- ----- -->

<hr>
<p>This is another excercise:</br>
  <script>
    function testLogicalAnd(val) {
  // Only change code below this line
     if (val <= 50 && val >= 25) {
       return "Yes. with \&\&</br>";
    }
  // Only change code above this line
     return "No. with \&\&</br>";
    }
// Change this value to test
document.write(testLogicalAnd(10));
    
  /*function testLogicalAnd2(val) {
    if (50 => val >= 25) {
      return "Yes";
    }
    return "No</br>";
  } */ 
  </script>
</p>

<!-- ----- -----  ----- ----- ----- -->

<hr>
<p></p>
<script>
  var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card) {
    case 2:
      count++;
    case 3:
      count++;
    case 4:
      count++;
    case 5:
      count++;
    case 6:
      count++;
    case 10:
    case "J":
      count--;
    case "Q":
      count--;
    case "K":
      count--;
    case "A":
      count--;
      break;
  }
  if(count > 0) {
    return "Bet";
  }
  else{
    return "Hold";
  }
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
  /*
</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console