Introduction to JavaScript

Learn the most popular programming language on the web

    let example = 'Dylan';
    
    console.log(example);
Dylan C. Israel2:224 months ago
    let firstName = 'Dylan';
    let lastName = 'Israel';
    
    
    
    console.log(`${firstName} ${lastName}`.split(' '));
Dylan C. Israel6:004 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:324 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:064 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:344 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:314 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:324 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:284 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:304 months ago

A comprehensive introduction to JavaScript


This course teaches you the basics of JavaScript, the most popular programming language on the web. JavaScript can be used to create websites, games, servers and native apps! It's a highly valuable skill to learn, and this course will give you the kick-start you need to get going. The instructor Dylan Israel runs the very popular YouTube channel Coding Tutorials 360, so you can be assured that you're in good hands.

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


What people are saying about Scrimba: