1. Math Functions
1.1 Math.random()
The
Math.random()
function returns a random number (float value) in range 0 to less than 1 (0 <= randomNumber < 1
).JAVASCRIPT
1.2 Math.ceil()
The
Math.ceil()
function always rounds a number up to the next largest integer.JAVASCRIPT
Try running the code multiple times and observe the output in the console.
2. HTML Elements
2.1 HTML Input Element
The HTML
input
element creates interactive controls to accept the data from the user.
There are different types of inputs.
- Text
- Password
- Radio
- Date
- Checkbox
2.1.1 Text Input
HTML
Note
Default type for the HTML
input
element is text
.2.1.2 Password Input
It provides a way for the user to enter a password securely.
HTML
3. DOM Properties
3.1 Value
We can use the
value
property to get the value of the HTML
input
Element.
JAVASCRIPT
Try out giving the different input values and check the output in the below Code Playground.
4. Comparison Operator
4.1 Loose equal to vs Strict equal to (== vs ===)
Loose equal to (
==
): Loose equality compares two values for equality but doesn’t compare types of values. Strict equal to (
===
): Strict equality compares two values for equality including types of values.
JAVASCRIPT
Try out giving the different input values and check the output in the below Code Playground.