i
Introduction Of JavaScript
Setup For JavaScript
Client-side and Server-side JavaScript
JavaScript Equivalents
JavaScript Syntax
JavaScript Variables
JavaScript Expressions
JavaScript Comments
JavaScript Identifiers
JavaScript Case Sensitive
JavaScript Function Definition
JavaScript Function Expressions
JavaScript Parameters and Arguments
JavaScript Function Invocation
JavaScript Self-invoking Functions
JavaScript Objects Definitions
JavaScript Object Properties
JavaScript Object Methods
JavaScript Object Constructors
JavaScript Object Prototypes
JavaScript Object ES5 standard
Strings Definition
Backslash escape character
Strings as Objects
String Methods
indexOf() and lastIndexOf():
search()
slice()
substring()
substr()
replace()
toUpperCase()
toLowerCase()
concat()
trim()
charAt()
charCodeAt()
split()
endsWith()
fromCharCode()
includes()
repeat()
startsWith()
valueOf()
Creating an Array
Array elements
Array Properties and Methods
Changing Elements of an array
Compare function of Array
Addition vs. Concatenation
Properties and Methods
JavaScript this Function
JavaScript let Function
Reserved Words
Removed reserved words
JavaScript Properties, Methods, and Objects
Java Properties and Objects
HTML and Window Properties, Objects and Event Handlers
Comparison operators
Logical Operator
Comparing different data types
Conditional Statements
else statement
switch statement
default statement
JavaScript Loops
JavaScript break statement
&&, || and ! are logical operators, and they can be applied to values of any type.
The below table explains the operators, its usage along with an example.
Operator |
Description |
Example |
Return value |
&& |
and – returns true if the conditions are true, false otherwise |
var x = 9; var y = 3; x < 20 && y > 5 |
false |
|| |
or – returns true if one of the conditions is true, false otherwise |
var x = 9; var y = 3; x < 20 || y > 5 |
true |
! |
not |
var x = 9; var y = 3; !(x == y) |
true |
Ternary Operator:
“?” is the ternary operator that is used to assign a value to a variable based on the truthy value of the condition.
Syntax:
variable = (condition) ? value1 : value2
If the condition evaluates to true, variable will be assigned the value , value1 else it will be assigned the value, value2.
Example:
var a = 10;
var b = (a > 5) ? 1 : 0;
The value of variable ‘b’ is 1, since a > 5 is true.
Don't miss out!