Skip to content

Commit 6769508

Browse files
committedMay 21, 2024
feat: number and math
1 parent de1d631 commit 6769508

10 files changed

+55
-20
lines changed
 

‎05_datatype/01_type_of_datatype.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ let array = [value1, value2, value3];
5454
// Function
5555
function functionName(parameter) {
5656
return parameter;
57-
}
57+
}

‎05_datatype/02_type_conversion.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
// Numbers
44

5-
// WHY
5+
// What
6+
// - Type conversion in JavaScript is the process of changing a value from one data type to another. This can happen automatically (called implicit conversion) or manually (called explicit conversion).
7+
8+
// Why
69
// - When we are fetching data from server sometimes data will have some numbers value. But the numbers are in string format for e.g. "999". At that time convert this to pure number 999 we need to use type conversion.
710

8-
// HOW
11+
// How
912
// - Number(): Use this function to convert string formatted number to pure number "999" to 999.
1013
// - parseFloat(): Use this function to convert string formatted floating number to floating number e.g. "3.14" to 3.14
1114
// - parseInt(): Use this function to convert string formatted integer number to integer number e.g. "3.14" to 3 .

‎08_string/1_string.js ‎08_string/01_string.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ console.log("Single quotes");
66
// Double quote
77
console.log("Double quotes");
88

9-
// Backtick
9+
// Backtick (Recommended)
1010
console.log(`Backtick`);
1111

1212
// Multiline string use backtick
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎08_string/string_vs_string_object.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
You're right, this can be a bit confusing at first. In JavaScript, strings can be thought of as having a dual nature: primitive data type and object.
2+
3+
* **Primitive Data Type:** At their core, strings are a fundamental data type in JavaScript. They are used to represent textual data, like words, sentences, or code. In this sense, they are simple building blocks for more complex data structures.
4+
5+
* **Object:** JavaScript also provides String objects, which are wrappers around primitive strings. These objects offer a collection of methods that allow you to manipulate the string data. For instance, you can find the length of a string, search for substrings within it, or convert the string to uppercase or lowercase using these methods.
6+
7+
Here's a key point to remember: Primitive strings are automatically converted to String objects whenever you use a string method on them. This process is called auto-boxing. So, behind the scenes, JavaScript creates a String object, applies the method, and then returns the result.
8+
9+
In essence, you can use strings as basic data types to store text, and when you need to perform operations on those strings, JavaScript provides String objects with built-in functionality.
10+
11+
I hope this clarifies the concept of strings in JavaScript!

‎README.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
Sure! Here is a list of all the operators in JavaScript:
4242

4343
### Arithmetic Operators
44+
4445
- `+` (Addition)
4546
- `-` (Subtraction)
4647
- `*` (Multiplication)
@@ -51,6 +52,7 @@ Sure! Here is a list of all the operators in JavaScript:
5152
- `--` (Decrement)
5253

5354
### Assignment Operators
55+
5456
- `=` (Assignment)
5557
- `+=` (Addition assignment)
5658
- `-=` (Subtraction assignment)
@@ -66,6 +68,7 @@ Sure! Here is a list of all the operators in JavaScript:
6668
- `^=` (Bitwise XOR assignment)
6769

6870
### Comparison Operators
71+
6972
- `==` (Equal to)
7073
- `!=` (Not equal to)
7174
- `===` (Strict equal to)
@@ -76,11 +79,13 @@ Sure! Here is a list of all the operators in JavaScript:
7679
- `<=` (Less than or equal to)
7780

7881
### Logical Operators
82+
7983
- `&&` (Logical AND)
8084
- `||` (Logical OR)
8185
- `!` (Logical NOT)
8286

8387
### Bitwise Operators
88+
8489
- `&` (Bitwise AND)
8590
- `|` (Bitwise OR)
8691
- `^` (Bitwise XOR)
@@ -90,19 +95,23 @@ Sure! Here is a list of all the operators in JavaScript:
9095
- `>>>` (Zero-fill right shift)
9196

9297
### String Operators
98+
9399
- `+` (Concatenation)
94100

95101
### Conditional (Ternary) Operator
102+
96103
- `? :` (Conditional)
97104

98105
### Type Operators
106+
99107
- `typeof`
100108
- `instanceof`
101109
- `in`
102110
- `void`
103111
- `delete`
104112

105113
### Other Operators
114+
106115
- `,` (Comma operator)
107116
- `...` (Spread/rest operator)
108117

@@ -124,20 +133,20 @@ Sure! Here is a list of all the operators in JavaScript:
124133
4. While Loop
125134
5. Do While Loop
126135

127-
9. Break & Continue
136+
9. Break & Continue
128137

129-
1. Break Keyword
130-
2. Continue
138+
10. Break Keyword
139+
11. Continue
131140

132-
10. Iteration
141+
12. Iteration
133142

134-
11. String Iteration
135-
12. Array Iteration
136-
13. Object Iteration
137-
14. Set Iteration
138-
15. Map Iteration
143+
1. String Iteration
144+
2. Array Iteration
145+
3. Object Iteration
146+
4. Set Iteration
147+
5. Map Iteration
139148

140-
16. String
149+
13. String
141150

142151
1. Escape Sequence
143152
2. String Concatenation
@@ -146,7 +155,7 @@ Sure! Here is a list of all the operators in JavaScript:
146155
5. String Index
147156
6. String Method
148157

149-
17. Array
158+
14. Array
150159
1. Array Are Object
151160
2. Array Operation
152161
3. Array Destructure

‎numbers_and_math.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Numbers
2+
3+
const number = 3.14619;
4+
console.log(number.toString());
5+
console.log(number.toFixed(2));
6+
console.log(number.toPrecision(4));
7+
8+
const loanAmount = 100000;
9+
console.log(loanAmount.toLocaleString("en-IN"));
10+
11+
// Math
12+
13+
// What
14+
// - Math is object in JavaScript.
15+
// - It has built in method which helps for math related operations.
16+
17+
console.log(Math);

‎themes_ranks.md

-5
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.