JavaScript
Lesson 1 of 8
13%
Free Section Starter (Lesson 1)
JAVASCRIPT Free Section Starter Challenge 20 min

1. Let, Const, Arrow Functions & Template Literals

Overview: Say goodbye to `var`. Master block scoping and compact arrow syntax.

Concept & Syntax Guide

Use `const` for values that don't change, and `let` for variables that do. Arrow functions `const add = (a, b) => a + b;` provide clean one-line return syntax.

Hands-On Practice Exercise

Write a Discount Calculator Function

Write an arrow function named `calcDiscount` that takes `price` and `discountPercent` and returns the final discounted price. For example, calcDiscount(1000, 20) should return 800.

Target Output: Final Price: 800
Need a hint? Click here to reveal
Hint: Check syntax carefully and make sure your code contains: Final Price: 800
JAVASCRIPT Code Editor
1
2
3
4
5
6
7
8
9
10