|
62 | 62 | | 55 | [If Javascript is single threaded, how it supports asynchronous operations](#55-if-javascript-is-single-threaded-how-it-supports-asynchronous-operations) |
|
63 | 63 | | 56 | [What is javascript scope](#56-what-is-javascript-scope) |
|
64 | 64 | | 57 | [Difference between global scope and local scope](#57-difference-between-global-scope-and-local-scope) |
|
65 |
| - |
| 65 | +| 58 | [What are the different ways to convert a string to an integer](#58-what-are-the-different-ways-to-convert-a-string-to-an-integer) | |
| 66 | +| 59 | [How to find the operating system in the client machine using JavaScript](#59-how-to-find-the-operating-system-in-the-client-machine-using-javascript) | |
| 67 | +| 60 | [Name some JavaScript frameworks and libraries](#60-name-some-javascript-frameworks-and-libraries) | |
66 | 68 |
|
67 | 69 | ### 1. What is JavaScript
|
68 | 70 | * JavaScript is a scripting language used to create dynamic and interactive websites. It is supported by all major web browsers.
|
@@ -919,6 +921,33 @@ console.log(name); // ReferenceError: name is not defined
|
919 | 921 | ```
|
920 | 922 | **[:top: Scroll to Top](#javascript-interview-questions)**
|
921 | 923 |
|
| 924 | +### 58. What are the different ways to convert a string to an integer |
| 925 | +
|
| 926 | +**1. parseInt()** - This function takes a string and an optional radix (a number between 2 and 36 that represents the base in a numeral system) as its arguments. |
| 927 | +```js |
| 928 | +console.log(parseInt("20")); // output ========> 20 |
| 929 | +console.log(parseInt("52", 8)); // output ========> 42 |
| 930 | +``` |
| 931 | +**2. unary plus operator (+)** - This operator converts a string into a number and it should be placed before the operand. |
| 932 | +```js |
| 933 | +console.log(+"10"); // output ========> 10 |
| 934 | +``` |
| 935 | +**3. Number()** - It is a built-in function which converts its argument to a number. If the argument is a string that contains non-numeric characters, then it returns NaN. |
| 936 | +```js |
| 937 | +Number("10"); // output ========> 10 |
| 938 | +Number("abc"); // output ========> NaN |
| 939 | +``` |
| 940 | +
|
| 941 | +### 59. How to find the operating system in the client machine using JavaScript |
| 942 | +We can use the **navigator.platform** property to find out the operating system of the client machine |
| 943 | +```js |
| 944 | +console.log(navigator.platform); // output ========> 'Linux x86_64' |
| 945 | +``` |
| 946 | +
|
| 947 | +### 60. Name some JavaScript frameworks and libraries |
| 948 | +**Frameworks** - Angular, Ember.js, Vue.js, Meteor, Next.js |
| 949 | +**Libraries** - React, Backbone.js |
| 950 | +
|
922 | 951 | ## Output Based Questions
|
923 | 952 |
|
924 | 953 | **1. What will be the output**
|
|
0 commit comments