Introduction to JavaScript

Learn the most popular programming language in the world through 24 tutorials. A simple one-hour course that can change your career.

    
    let example = 'Dylan';
    
    console.log(example);
Dylan C. Israel2:2211 months ago
    let firstName = 'Dylan';
    let lastName = 'Israel';
    
    
    
    console.log(`${firstName} ${lastName}`.split(' '));
Dylan C. Israel6:0011 months ago
    let firstName = "Dylan";
    let lastName = "Israel";
    
    const fullName = `${firstName} ${lastName}`;
    
    console.log(fullName);
    let example = 7.77;
    
    console.log(example.toFixed(2));
Dylan C. Israel2:3211 months ago
    let example1 = parseInt("33 World 22");
    let example2 = parseFloat('44 Dylan 33');
    let example3 = 55.3333.toFixed(0);
    let example4 = 200.0.toFixed(2);
    
    console.log(typeof example1);
    console.log(example2);
    console.log(example3);
    console.log(example4);
    let example1 = 666;
    
    console.log(Boolean(example1))
Dylan C. Israel1:0611 months ago
    let example1 = false;
    let example2 = true;
    let example3 = null;
    let example4 = undefined;
    let example5 = '';
    let example6 = NaN;
    let example7 = -5;
    let example8 = 0;
    
    console.log(Boolean(example1));
    console.log(Boolean(example2));
    console.log(Boolean(example3));
    console.log(Boolean(example4));
    // console.log(Boolean(example5));
    let example1 = [5, 7, 6];
    
    example1.push(8, 9, 10);
    example1.pop();
    
    example1[0] = 1;
    
    example1.forEach((element) => {
        console.log(element)
    });
    
    console.log(example1)
Dylan C. Israel3:3411 months ago
    let example1 = ['Dylan', 5, true];
    
    let example2 = example1;
    
    example2.push(11);
    
    console.log(example1);
    console.log(example2);
    let example1 = {
        firstName: 'Dylan',
        lastName: 'Israel',
        address: {
            city: 'Austin',
            state: 'Texas'
        },
        age: 30,
        cats: ['Milo', 'Tito', 'Achieles']
    };
    
    example1.age = 31;
    
    console.log(Object.values(example1));
Dylan C. Israel3:3111 months ago
    let example1 = {
        firstName: 'Dylan'
    };
    
    let example2 = Object.assign({}, example1);
    
    example2.lastName = 'Israel';
    
    console.log(example1);
    console.log(example2);
    let example1 = 5 ;
    
    console.log(example1)
    let example1 = 10;
    let example2 = '10';
    
    console.log(typeof example1);
    console.log(typeof example2);
    console.log(example1 == example2);
    console.log(example1 === example2);
    let example1 = 5 === 5;
    let example2 = 5 == '5';
    let example3 = 6 != '6';
    let example4 = 7 !== '7';
    
    console.log(example1);
    console.log(example2);
    console.log(example3);
    let example1 = 1;
    
    example1 *= 5;
    
    console.log(example1);
    let example1 = 5;
    
    
    console.log(example1++);
    
    let example2 = 5;
    
    
    console.log(++example2);
    let example = 5;
    
    if (example === 6) {
        console.log('Runs');
    } else if ( false ) {
        console.log('else if')
    } else {
        console.log('else')
    }
    console.log(10 === 10 && 5 < 4);
    
    console.log(10 === 10 || 5 < 4);
    console.log((5 >= 5 || 4 > 4) && 3 + 2 === 5);
    let studentAnswer = 'D';
    
    switch(studentAnswer) {
        case 'A': 
            console.log('A is wrong.');
            break;
        case 'B' :
            console.log('B is wrong.');
            break;
        case 'C':
            console.log('C is correct.');
            break;
        default: 
            console.log('Not a real answer.');
Dylan C. Israel3:3211 months ago
    let total = 0;
    
    let numArray = [10, 20, 30, 40, 50, 60, 70, 80];
    
    for (let i = 0; i < numArray.length; i++) {
        console.log(numArray[i])
        total += numArray[i];
    }
    
    // console.log(total);
Dylan C. Israel3:2810 months ago
    let count = 0;
    
    do {
        count++;
        
        if(count >= 20) {
            break;
        }
    }
    while (false)
    
    console.log(count);
    function add() {
        return 5;
    }
    
    console.log(add());
    add();
    add();
    add();
Dylan C. Israel3:3011 months ago

The future is written in JavaScript


This course teaches you the basics of JavaScript, the most popular programming language in the world. JavaScript can be used to create websites, games, servers and even native apps! So it's no wonder that this language is a critical component of almost all businesses and industries.

This makes JavaScript a highly valuable skill to learn. It can be a critical component in order to advance in your career in the direction you want. That's why we've created this free course. It'll teach you the basics in about an hour. So there's no reason to hesitate, just get started today! Your future self will thank you.

Course content

The course contains 14 lessons and 7 challenges. In the challenges, you'll be encourage to jump into the code and get your hands dirty. This is both fun and great for making the knowledge stick.

What you’ll learn

  • Data types
  • Variables
  • Strings
  • Numbers
  • Booleans
  • Arrays
  • Objects
  • Arithmetic operations
  • Relational operations
  • Increment & decrement
  • If, else if, else
  • Switch statements
  • For loops
  • Functions

About the instructor

The instructor Dylan Israel runs the popular YouTube channel Coding Tutorials 360 and he has also previously created two successful Scrimba courses, so you can rest assured that you're in good hands.

What people are saying about Scrimba: