console.log(“Hello!”);

This weekend was busy so I didn’t manage to do much on Codeacademy. I did start the intro to JavaScript lessons though and am having fun learning the syntax. I’ve gathered that there are better ways to learn JavaScript so I’m a little hesitant to get too far in the lessons, but it will do for now. I’m still planning to work though both modules on Codeacademy and freeCodeCamp. So far I’ve skimmed through JavaScript basics offered through Mozilla. This Quora post has useful information.

Some notes-

Primitive Data Types

  1. strings: a group of keyboard characters sandwiched between single or double quotes. Ex. console.log(‘New York City’);
  2.  numbers: self explanatory Ex. console.log(40.6);
  3. booleans: a binary variable, having two possible values called “true” and “false.”
  4. null: no value.
  5. undefined: let whatAmI;  –> variable with no value

Math Operators +,-,*,/

Variables

  • const’ as constant variable, JavaScript keyword that creates a new variable
    • Ex. const(keyword) myName(variable name) (operator) ‘gruncheon’(value assigned);
      console.log(myName);
      //output: gruncheon
    • Ex. Create const. variable named ‘entree’ = string ‘Enchiladas’
      • A: const entree = ‘Enchiladas’;
    • Ex. Under the entree variable, create a constant variable named ‘price’ that saves the value of 12
      • A: const price = 12; console.log(price);  –>12
    • Ex. Under price variable, use console.log() to print the value saved to price
      • A: console.log(entree,price);
  • let – variables that can be reassigned.
    • let(keyword) meal(variable) = ‘Enchiladas’(string);
      console.log(meal);
      meal = ‘Tacos’;
      console.log(meal);
    • Ex. Create a let variable called changeMe and set it equal to boolean true. 
      • A: let changeMe = true;
  • mathematical assignment operators
      • let molecule =  16;
        let particle = 18;
        let assay = 3;

        // Add and assign to molecule below (add 16 to value of molecule)
        A: molecule += 16;
        // Multiply and assign to particle
        A: particle *= 3.14; (random # for example sake) 
        // increment assay by 1 (increase value by 1)
        A:assay ++ ;
  • string interpolation 
    • New version ES 6 allows you to insert variables into strings 2 ways
      • 1. instead of quotes use backticks `
      • 2. wrap variables with ${myVariable} followed by phrase. No “=” needed.
        Ex.
        let MyPet = `armadillo`
        console.log(I own a pet ${myPet}.)
        //output: I own a pet armadillo.

*Some computer wizardry changed the font up there when I wrapped the variable with the $ sign. 

 

So that included intro to JavaScript and variables from codeacademy. I’m starting control flow and from there it looks like I’ll learn: functions, scope, arrays, loops, iterators, objects, classes, browsers magic, modules, and requests. Tomorrow marks a month since starting the intro to HTML. I think I need to go back and mess around with some CSS grid and flexbox but I’m really interested in jumping into JavaScript. So much to learn, so little time.

Somebody on the freecodecamp Facebook group suggested checking out Flexbox Froggy.

Leave a comment