You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: JavaScript-Quick-Reference.md
+49-3Lines changed: 49 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ A comprehensive yet concise quick-reference and overview of JavaScript fundament
26
26
-[3.6 Error Handling](#36-error-handling)
27
27
## Global JavaScript Objects
28
28
-[4.1 String](#41-string)
29
-
-[4.2 Number](#42-number)
29
+
-[4.2 Numbers](#42-numbers)
30
30
-[4.3 Math](#43-math)
31
31
-[4.4 Date](#44-date)
32
32
## DOM & DOM Manipulation
@@ -527,6 +527,7 @@ person.greet("Hello"); // Calls the greet method with "Hello" as an argument, ou
527
527
```
528
528
529
529
### Methods of the Object Constructor
530
+
Methods of the Object constructor in JavaScript provide a set of utility functions for creating, manipulating, and working with objects, including methods for object creation, property manipulation, and property enumeration.
530
531
-`Object.assign(target, ...sources)` Copies values from source to target objects.
531
532
-`Object.create(proto, propertiesObject)` Creates a new object with the specified prototype and properties.
532
533
-`Object.defineProperty(obj, prop, descriptor)` Defines a new property on an object.
@@ -688,6 +689,24 @@ Fundamental number-related functionalities in JavaScript.
688
689
-`parseInt("10", 10);` Converts the string "10" to an integer (base 10).
689
690
-`parseInt("10", 2);` Converts the string "10" to an integer (base 2, binary).
690
691
692
+
### parseInt Example
693
+
694
+
```javascript
695
+
// Sample input from the user
696
+
constuserInput="42";
697
+
698
+
// Using parseInt to convert the string to an integer
699
+
constparsedNumber=parseInt(userInput);
700
+
701
+
// Checking if the conversion was successful
702
+
if (!isNaN(parsedNumber)) {
703
+
console.log(`Parsed number: ${parsedNumber}`);
704
+
console.log(`Type of parsedNumber: ${typeof parsedNumber}`);
705
+
} else {
706
+
console.log("Conversion failed. Please enter a valid number.");
707
+
}
708
+
```
709
+
691
710
### parseFloat(string)
692
711
`parseFloat("3.14");` Converts the string "3.14" to a floating-point number.
0 commit comments