D
D
dimasan572020-04-27 18:20:54
JavaScript
dimasan57, 2020-04-27 18:20:54

How to create a condition?

5ea6f737a28aa731740113.png
I am making a calculator and it is necessary to make a condition if the variable B>1, then to the value +100 +200 +300.
Simply put, the delivery slider, the first kilometer is 2500 rubles, the subsequent +100 rubles.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilkhomjon Matazimov, 2020-04-27
@mr_qpdb

(A * 4500) + (B + 2500) + result()
function result() {
  if (B > 1) {
    B + 100
  } else {
    B + 0
  }
}

M
maralov, 2020-04-27
@maralov

let a = 1,
b = 1,
d = 0,
res;
if (b > 1) {
b += 100
} else {
b = 0
}
res = ( a * 4500) + (b + 2500) + d

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question