I am trying to prove that one operation takes less time than 2 operation,so i am using below steps
var a=performance.now();
c=10+40;
d=80+90;
var b=performance.now();
console.log(b-a);
a=performance.now();
l=10+40;
b=performance.now();
console.log(b-a);
but results varies from execution to execution like below
0.009999997913837433
0.034999996423721313
//second execution
0.010000001639127731
0
//Thirdexecution
0.009999997913837433
0.015000000596046448
even i tried with
console.time('a');
c=10+40;d=80+90;
console.timeEnd('a');
console.time('b');
l=10+40;
console.timeEnd('b');
even same operation not giving exact values
z=performance.now()
a=10+60;
x=performance.now()
console.log(x-z)
output:
//on first execution
0.009999999776482582
//on second execution
0.015000000596046448
still the result is same, please shed some light on this topic.