PeppeL-G / course-material

A repository containing the course materials for the courses I teach at Jönköping Univeristy.
5 stars 7 forks source link

Example 1 #1

Open PeppeL-G opened 5 years ago

PeppeL-G commented 5 years ago

Course

Client-Server Communication

The problem

I'm trying to compute and display the sum of 8 and 9 in JavaScript.

Failed attempt

My JavaScript code looks like this:

const sum = 5 + 9
alert(sum)

When I run the code in a web browser it displays the number 14 instead of the expected number 17.

The question(s)

Why does it display the number 14 instead of the expected number 17?

PeppeL-G commented 5 years ago

With your current code you compute the sum of 5 and 9, not the sum of 8 and 9.

Close this issue if you think your problem is solved.