+6

# Could you explain?

var a=1; document.write(a++); document.write(++a); Output is 13

+4

a++ is post-increment, hence it print value of a (which is 1) and increment it. So now a has become 2. ++a is pre-increment so now the value of a(which is already 2) increases by 1, and a becomes 3 and then it will be printed. Since there is no next line, output you get is 13.

+13

document.write(a++) // Write a which is 1 and increment it. document.write(++a) // Increment a (now 3) and write it (3). There was no line break so both numbers are next to each other: 13.

+6

a++: first outputted, then incremented (to 2) ++a: first incremented (to 3), then outputted

+5

It firstly shows the 1 and then then it shows 3 there is no line break so it shows 13 Well the actual value of x is 3

+4

there are prefix and postfix increments so by this write istead of writeline results are written near by each other.

+3

You forgot make a line break...

+3

Fill in the blanks to import the following from "util/calc.js": export const hit = (x, y, z) => { return x * y + z / 2; } export const degree = 50; * calc from "util/calc"; calc.hit(1, 2, calc.degree);

+2

This is not 13.This is 1 and 3 concat.

+1

the first one a++ output 1 after a became 2 the second one ++a output 3 because 2+1=3

0

Your question has been thoroughly answered? @Safaa There are two outputs: The first document.write outputs 1, The second one outputs 3 Since there is no space, separator or line break, they are written side by side to appear as 13 when actually it should be 1 and 3.