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

+ add another resource


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


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.


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.


                <body onload="myFunction()">
          <div style="text-align:center">
                <label for="points">Number of exercises:</label>
                <input id="userInput" type="range" placeholder="6" value="6" step="1" min="1" max="" oninput="numberOutputId.value = userInput.value">
                <output name="numberOutputName" id="numberOutputId">6</output>
              <input class="btn" type="button" value="Create new workout" onclick="myFunction();" />
            <ol id="todays_exercises"></ol>




                body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 28px;

  #todays_exercises {
  border-radius: 5px;
  border: 1px solid LightGrey;
  max-width: 350px;
  margin: auto;
  box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 15%);
  padding: 30px;
  padding-left: 80px;
  list-style-position: outside;
  margin-top: 50px;
  line-height: 40px;

.btn {
  border-radius: 5px;
  text-transform: uppercase;
  color: #ffffff;
  font-size: 0.8rem;
  background: #0075FF;
  padding: 15px 15px 15px 15px;
  text-decoration: none;
  border-style: none;

.btn:hover {
  filter: brightness(125%);
  text-decoration: none;
  cursor: pointer;


                // get the slider value
    function getNumber(){
        let input = document.getElementById("userInput").value;
      return input

//triggered by the main button: set the number of exercises to "n"
    function myFunction() {
    let n = getNumber() 

//clear the list of any existing exercises
    document.getElementById("todays_exercises").innerHTML = "";

//define the array
    let all_exercises = [ 
      " air squats ×40",
      " skip ×200",
      " burpees ×20",
      " row 500m",
      " pull-ups ×10",
      " finger board pull-ups ×10",
      " ring pull-ups ×10",
      " sit-ups ×40",
      " press-ups ×25",
      " lunges ×20",
      " curls ×15",
      " ring rows ×12",
      " assisted ring dips ×10",
      " ring push ups ×10",
      " power snatch ×10",
      " power clean ×20",
      " power clean & jerk ×15",
      " hanging leg raises ×20",
      " bench press ×10",
      " calf raises ×20",
      " plank 20s",
      " dips ×20",
      " row 250m"

//Set the max value of the slider (with id=userInput) to the # of elements in the array
    document.getElementById("userInput").setAttribute('max', all_exercises.length);

// shuffle the full array
    function shuffleArray(array) {
        for (let i = array.length - 1; i > 0; i--) {
            const j = Math.floor(Math.random() * (i + 1));
            [array[i], array[j]] = [array[j],  array[i]];

// pull out the first n values from the shuffled array and display as ordered list
    all_exercises.slice(0,n).forEach(e => {
        todays_exercises.innerHTML =  todays_exercises.innerHTML + '<li>' + e + '</li>' ;