MOTOSHARE 🚗🏍️

Rent Bikes & Cars Directly from Owners

Motoshare connects vehicle owners with people who need bikes and cars on rent. Owners earn from idle vehicles, and renters get flexible ride options.

Visit Motoshare

How many data types How to work are there in JavaScript?

JavaScript

Boolean

Boolean is the built-in object corresponding to the primitive Boolean data type. JavaScript boolean can have one of two values: true or false.

Primitive Values
var primitiveTrue = true;
var primitiveFalse = false;

Boolean Function
var functionTrue = Boolean(true);
var functionFalse = Boolean(flase);

Boolean Constructor
var constructorTrue = new Boolean(true);
var constructorFalse = new Boolean(false);

Boolean

If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (“”), the object has an initial value of false.

String

A string is a built-in object corresponding to the primitive string data type.
A string is a group of characters.

String

Primitive
var str = “Hello DevopsSchool”;——————————
var str = „Hello DevopsSchool‟; ——————————String
var str = Hello DevopsSchool;—————————–

Constructor
var str = new String (“Hello DevopsSchool”);——————————
var str = new String („Hello DevopsSchool‟); —————————– Object
var str = new String (Hello DevopsSchool);—————————–

Accessing String

Access String

String Concatenation

Concat Operator

Template Literal/ Template Strings

Template literals are string literals allowing embedded expressions. You can
use multi-line strings and string interpolation features with them.
Template literals are enclosed by the back-tick () character instead of double
or single quotes.

Multiple Line String

String Interpolation

Template literals can contain placeholders. These are indicated by the dollar sign and curly braces
(${expression})

String Methods

  • charAt ( )
  • charCodeAt( )
  • toUpperCase( )
  • toLowerCase ( )
  • Trim( )
  • Replace ( )
  • Split ( )
  • indexOf( )
  • Search ( )
  • Slice ( )
  • Substring( )
  • Substr ()
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x