Count all odd numbers between 1 and 100 

   
   

Output:

1 is odd number
3 is odd number
5 is odd number
7 is odd number
9 is odd number
11 is odd number
13 is odd number
15 is odd number
17 is odd number
19 is odd number
21 is odd number
23 is odd number
25 is odd number
27 is odd number
29 is odd number
31 is odd number
33 is odd number
35 is odd number
37 is odd number
39 is odd number
41 is odd number
43 is odd number
45 is odd number
47 is odd number
49 is odd number
51 is odd number
53 is odd number
55 is odd number
57 is odd number
59 is odd number
61 is odd number
63 is odd number
65 is odd number
67 is odd number
69 is odd number
71 is odd number
73 is odd number
75 is odd number
77 is odd number
79 is odd number
81 is odd number
83 is odd number
85 is odd number
87 is odd number
89 is odd number
91 is odd number
93 is odd number
95 is odd number
97 is odd number
99 is odd number
There are 50 odd number
by

Javascript Online Compiler

Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.

About Javascript

Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.

Key Features

  • Open-source
  • Just-in-time compiled language
  • Embedded along with HTML and makes web pages alive
  • Originally named as LiveScript.
  • Executable in both browser and server which has Javascript engines like V8(chrome), SpiderMonkey(Firefox) etc.

Syntax help

STDIN Example


variable declaration

KeywordDescriptionScope
varVar is used to declare variables(old way of declaring variables)Function or global scope
letlet is also used to declare variables(new way)Global or block Scope
constconst is used to declare const values. Once the value is assigned, it can not be modifiedGlobal or block Scope

Backtick Strings

Interpolation


Multi line Strings


Arrays

An array is a collection of items or values.

Syntax:


Example:


Arrow functions

Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.

Syntax:


Example:


De-structuring

Arrays


Objects


rest(...) operator


Spread(...) operator


Functions


Loops

1. If:

IF is used to execute a block of code based on a condition.

Syntax


2. If-Else:

Else part is used to execute the block of code when the condition fails.

Syntax


3. Switch:

Switch is used to replace nested If-Else statements.

Syntax


4. For

For loop is used to iterate a set of statements based on a condition.


5. While

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.


6. Do-While

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.


Classes

ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.

Syntax:


Example:



© Copyright 2025 One Compiler Pvt. Ltd. | Privacy Policy | Terms & Conditions