What formula should I Use?

Hi!.. I’m new here,

I would like to create a function for this problem.

Maximum checkPoint is 30

If we at checkPoint 5, what page we should start reading?

5 - 1 = 4 // - 1 is formula

4 * 2 = 8 // * 2 is formula

8 add number 2 at the back = 82 // add number 2 at the back is formula

answer 82 // print 82

I’m confuse how to add the 2 at the back of the result?

Hi,

I’m sorry if I don’t fully understand your question, but I will try to answer with some suggestions.

In javascript you can declare a variable:

let x;

// then you can set the variable to equal some equation:

x = 4 + 4;

//now the value of x is 8, if you log this:

console.log(x);

// the output will be 8

Note that division has quirks in programming for which you may need a way to either round numbers or set a fixed precision: Floating Point Numbers - Computerphile - YouTube

2 Likes