TalentJR

Lesson 2

Variables & Types

Data types in JavaScript

1What is JavaScript?✨

JavaScript is a versatile programming language primarily used for creating dynamic content on websites. It allows you to make your web pages interactive and exciting!

2Why Learn JavaScript?🎯

  • ✓ Essential for web development
  • ✓ Enables interactive web applications
  • ✓ Supported by all modern browsers
  • ✓ Great for building games and apps

3Your First Program💡

💻 code
Every programmer writes this first:
console.log("Hello, World!");

This tells JavaScript to display text in the console.

4JavaScript Basics🚀

  • Variables store data values
  • Use `let`, `const`, or `var` to declare variables
  • Types include numbers, strings, booleans, and more

5Variable Examples🔍

Here are some examples of how to declare variables in JavaScript:

💻 code
let age = 15;  
const name = "Alice";  
var isStudent = true;

You can use these variables to store information about yourself!

6Data Types⭐

💻 code
JavaScript has several data types:
- Number: represents numeric values (e.g., 10, 3.14)
- String: represents text (e.g., "Hello")
- Boolean: represents true or false values
- Object: a collection of properties (e.g., {name: "Alice", age: 15})

7Type Checking🧩

You can check the type of a variable using the `typeof` operator:

💻 code
console.log(typeof age); // "number"  
console.log(typeof name); // "string"  
console.log(typeof isStudent); // "boolean"

This helps you understand what kind of data you're working with!

8What You'll Build This Grade🎈

  • ✓ Interactive websites that respond to user input
  • ✓ Simple games using JavaScript
  • ✓ Dynamic web applications
  • ✓ Fun projects to showcase your skills

🎯 Practice Challenges

Master Variables & Types by completing all 3 difficulty levels

🟢 EASY

Variables & Types - Easy Challenge

Start with the basics. Perfect for beginners!

🟡 MEDIUM

Variables & Types - Medium Challenge

Get more challenging. Build your confidence!

🔴 HARD

Variables & Types - Hard Challenge

Master this concept. Prove your skills!

🏆 Study a lesson for 2+ minutes to earn +10 TalentJR Points a day. Badges, certificates & prizes →

Ready to Master Variables & Types? 🚀

Complete the challenges, take the quiz and keep your learning streak going!