Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions assignment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

// convert to number explicitly

let numberstr;
// string to number
numberstr=Number("678");
console.log(numberstr);//678

//the number() method converts a string into a number.
//the number("678") returns a number from a string"678".

//convert to string explicitly

let num ;
//number to string
num=string(235);
console.log(num);//"235"

// the string() method converts a variable to strings.
//the string(235) returns a string from a number literal 235

//convert to boolean
let truthyValue;
truthyValue=Boolean("welcome");
console.log(truthyValue);//true

//the Boolean() method converts a variable to boolean.
// the Boolean("welcome") returns a true from a string"welcome"

let falsyValue;
falsyValue=Boolean(0);
console.log(falsyValue);//false

// the Boolean() method converts a variable to boolean.
//the boolean(0) returns a false from a number literal 0.