Giter Club home page Giter Club logo

flw1-u1l3-23-24-student-exercises's Introduction

Lesson 1.3: Documentation, Variables & Data Types

๐ŸŽฏ Objectives

  • Understand and use JavaScript variables.
  • Work with basic data types and operators.

Table of Contents

  1. Documentation
  2. JavaScript & Variables
  3. Data Types & Operators

Documentation

  • Documentation is crucial for:
    • Understanding code.
    • Using code.
    • Debugging.
    • Collaborating with peers.
  • Use the Code Nation Coding Guides to refer to class syntax.
  • Remember: Googling is part of a developer's job! Platforms like W3Schools and egghead.io can be invaluable.

JavaScript & Variables

JavaScript Image

  • JavaScript enables dynamic behaviors on a webpage.
  • Variable is a container that holds data.
    let box;
    box = 8;

Rules for naming variables:

  • Cannot start with a number.
  • Cannot be keywords.
    let mySpiritAnimal = "unicorn";  // Valid
    let thisIsAcceptable = "acceptable";  // Valid

Variable Declaration & Assignment:

  • We can declare and assign a value to a variable in two steps or in one step.

    let cake;
    cake = "lemon";
    // OR
    let cake = "lemon";
  • Variables can be reassigned.

    let myBox = 8;
    myBox = 56;  // myBox is now 56

Data Types & Operators

Data Types

  • Numbers: Can be positive/negative and may have decimals.

    let num = 1234;
    let decimalNum = 1.99;
  • Strings: Textual data enclosed in quotes.

    let greeting = "Hello, World!";
    let codeString = "code123";

Arithmetic Operators

  • Basic operators include: +, -, *, /.

    let num1 = 10, num2 = 5;
    let sum = num1 + num2;  // 15
  • Strings can also be concatenated using the + operator.

    let str1 = "Hello, ";
    let str2 = "World!";
    console.log(str1 + str2);  // Hello, World!
  • Mixing data types can produce unexpected results.

    console.log(5 + "cat");  // 5cat

This lesson covered the importance of documentation, declaring variables in JavaScript, the basic data types, and how to perform operations on them. Always remember to refer to documentation when in doubt.

Keep practicing and happy coding!

flw1-u1l3-23-24-student-exercises's People

Contributors

cn-curriculum avatar cn-mika avatar jakefishbain avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.