DEV Community

benboorstein
benboorstein

Posted on • Edited on

Quick Notes Based On "Loops" Section of Frontend Masters' "Complete Intro to Web Development, v2"

What I did (in code):

    let brownieSundaes = 8
    while (brownieSundaes > 0) {
       brownieSundaes--
       console.log('I'm in hedonist heaven')
    }

    Logs eight times: I'm in hedonist heaven

    let chocolateCreamPieSlices = 0
    for (let i = 0; i < 8; i++) {
       chocolateCreamPieSlices++
       console.log('I'll be full once I've eaten eight')
    }

    Logs eight times: I'll be full once I've eaten eight

    console.log(4 ** 3)

    Logs: 64

What I did (in English):

  • Assign 8 to the variable brownieSundaes. The while loop: While brownieSundaes is greater than 0, decrement brownieSundaes by 1 and log to the console the string I'm in hedonist heaven.
  • Assign 0 to the variable chocolateCreamPieSlices. The for loop: Set the variable i to start at 0, run the loop as long as i is less than 8, and at the end of each iteration of the loop, increment i by 1. Each iteration of the loop, increment chocolateCreamPieSlices by 1 and log to the console the string I'll be full once I've eaten eight.
  • Log to the console the result of 4 to the power of 3.

What I practiced:

  • Same as above.

What I learned:

  • From the above code, I learned one new thing, and that's the Exponentiation Operator (**).
  • From other parts of this section of instruction, I learned...

...that the let i = 0 part of a for loop is called the Control Variable

...that the JavaScript language came from the C language

...The Principle of Least Power (which was being discussed in the context of how often to use const instead of let)

What I still might not understand:

  • Nothing for this section.

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

👋 Kindness is contagious

Delve into this thought-provoking piece, celebrated by the DEV Community. Coders from every walk are invited to share their insights and strengthen our collective intelligence.

A heartfelt “thank you” can transform someone’s day—leave yours in the comments!

On DEV, knowledge sharing paves our journey and forges strong connections. Found this helpful? A simple thanks to the author means so much.

Get Started