Loading your page…
YOUR LEARNING PATH
Short exercises, progressive hints and explanations to help you move forward.
TRY WITHOUT AN ACCOUNT
Read a short example, predict the result and learn from the explanation. You can try as many times as you like.
const price = 4;
const quantity = 3;
console.log(price * quantity);Write your answer in the field above.
Expected: 12
price holds 4 and quantity holds 3. Their product is 12. const prevents reassignment; it does not change the calculation.
With a quantity of 5, the result would be 20. Identify the one line to change.
This discovery session stays on this page. An account saves progress in the full course, with daily hearts for free learning.
Learn JavaScript to work with data and make pages interactive. Start with variables, then practise functions, arrays and asynchronous operations.
Before you start: No experience is required to start. Basic HTML helps with browser exercises.
function total(price, quantity) {
return price * quantity;
}
console.log(total(4, 3)); // 12The function receives a price and a quantity and returns their product. It prints 12. return passes a value back; console.log lets you inspect it.
Try it: Call total with a price of 7 and a quantity of 3. Predict the result before running the code.
Want to understand what each plan includes? Compare plans
JavaScript is the universal language of the web. It is essential for interactive websites, modern frontend frameworks (React, Next.js), and backend servers with Node.js.
Despite similar names, Java and JavaScript are distinct languages. Java is a compiled object-oriented language for enterprise servers, while JavaScript is the native dynamic language of web browsers.
Projet Carthage offers 402 progressive interactive exercises covering basic variables, modern ES6+, async/await promises, and live DOM manipulation.