Skip to content

Commit 7eec4cb

Browse files
feat: add boolean object
1 parent eaeefc2 commit 7eec4cb

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

part1 (Basics)/built-in-objects/12_json.object.js renamed to part1 (Basics)/built-in-objects/06_json.object.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,3 @@ Converts a JSON string into a javascript object.
3535
const jsonStr = '{"name": "Rafay", "age": 25}';
3636
const parsed = json.parse(jsonStr);
3737
console.log(parsed.name);
38-
39-
40-
41-
42-
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
INFO: Boolean Object
3+
The Boolean object is a wrapper for true or false values. It represents a logical entity and is often used in conditions.
4+
*/
5+
6+
// To create a boolean:
7+
let a = true;
8+
let b = new Boolean(false); // Boolean object (not recommended)
9+
10+
// Properties of Boolean
11+
Boolean.prototype; // allows you to add methods to all Boolean instances.
12+
13+
// Methods of Boolean
14+
let x = true;
15+
console.log(x.toString()); // "true"
16+
console.log(x.valueOf()); // true

0 commit comments

Comments
 (0)