@gunarajk,
I don't know javascript exactly, but this should get you started:
Const CRLF= (characters for carriage return and line feed)
Dim strOutput
strOutput = ""
for x = 1 to 50
if x modulo 2 = 0 then strOutput = strOutput & x
if x modulo 2 = 0 and x modulo 10 <> 0 then strOutput = strOutput & " "
if x modulo 10 = 0 then strOutput = strOutput & CRLF
next x
echo strOutput