• in
InterCourses
CoursesBlogs
0
← Introduction to JavaScript
○What is JavaScript?○Your First JavaScript Code○Data Types○Type Checking
○Declaring Variables●let and const in Practice○Operators○Type Conversion
○Conditionals○Switch Statement○For Loops○While Loop○Break and Continue
○Defining Functions○Arrow Functions○Scope○Closures○Project - Calculator○Function Expressions
○Arrays○Array Mutation Methods○Array Search and Slice○Array Iteration Methods○Multidimensional Arrays○Destructuring○Array Reverse and Sort○Array Fill○Array Find and Includes○Array Flat and FlatMap○Array Reduce, Some, and Every
○Objects○Object Methods and Destructuring○JSON○Math and Date○Date Basics
○02 Template Literals○String Methods○Regular Expressions
○Higher-Order Functions○Callbacks○map, filter, and reduce○Recursion○Project - Data Transform Pipeline
○OOP Introduction○Classes○Inheritance○Encapsulation
○Asynchronous JavaScript○Promises and Async Await○Async API Simulation

let and const in Practice

In this exercise you will declare variables using const and let following best practices. Remember:

  • const for values that should not be reassigned.
  • let for values that will change.

Your Task

  1. Declare a const named greeting with the string value "Hello, JavaScript!".
  2. Declare a let named score with the initial value 0.
  3. Increase score by 10 using +=.
  4. Display both values in the #output paragraph — format: "Hello, JavaScript! Score: 10".
Hint 1
1 / 3
HINT 1

Use const when the value should not change, let when it will.

Loading editor…
READY
intercourses
javascript