DEV Community

benboorstein
benboorstein

Posted on • Updated on

Quick Notes Based On "Numbers, Strings, and Booleans" Section of Frontend Masters' "Complete Intro to Web Development, v2"

What I did (in code):

    const myFirstName = 'Ben'
    const myLastName = 'Boorstein'

    const sentenceOldWay = 'Hi, ' + myFirstName + ' ' + myLastName + ', ' + 'how are you?'
    const sentenceNewWay = `Hi, ${myFirstName} ${myLastName}, how are you?`

    console.log(sentenceOldWay)
    console.log(sentenceNewWay)

    Logs: Hi, Ben Boorstein, how are you?
    Logs: Hi, Ben Boorstein, how are you?

What I did (in English):

  • I declared a const variable called myFirstName and stored in it (i.e., assigned to it) 'Ben' (a string).
  • I declared a const variable called myLastName and stored in it (i.e., assigned to it) 'Boorstein' (a string).
  • I declared a const variable called sentenceOldWay and stored in it a string that combined the above variable strings and new strings, and I did this the old way, i.e., using string concatenation.
  • I declared a const variable called sentenceNewWay and stored in it a string that combined the above variable strings and new strings, and I did this the new way, i.e., using template literals (aka template strings).
  • I logged both sentenceOldWay and sentenceNewWay to the console.

What I practiced:

  • Same as above.

What I learned:

  • From the above code, I didn't learn anything new.
  • From other parts of this section of instruction, I didn't learn anything new, because I already knew it. But I was reminded that in JS what we would, in regular English, call integers and decimal numbers are both just considered Numbers, and that in JS decimal numbers are called 'floats'.

What I still might not understand:

  • Nothing for this section.

Discussion (0)