The typeof operator returns a string indicating the type of the unevaluated operand.(source: MDN) Numbers 2.String 3. Booleans 4.Object 5. Function 6.undefined 7.Symbol Remember I referred here for writing this article. Follow Javascript Jeep🚙 for more interesting Javascript tips.
Tag Archives: learn Javascript
Javascript Tips : 1 → Using Closure functionality to create a function that sets the style to…
The styleSetter function will return a function that has a local reference to the element that we have passed to styleSetter function so this is stored in the scope of the function which is returned by the function styleSetter . Follow Javascript Jeep🚙 🥶.
Learn TypeScript:Part 2 → Type declaration.
Learn basic features of typescript Create a new file with extenstion .ts ,say add.ts In that file we will create a variable a , then assign different types of values then see what typescript says When we compile the code using tsc add.ts . It generates a.js file in the same folder . And it doesn’t reports any error. So …
Continue reading “Learn TypeScript:Part 2 → Type declaration.”
Learn TypeScript . Part 1.
First part in learning TypeScript. What is TypeScript ? TypeScript is modern JavaScript + types . TypeScript is an open-source programming language developed and maintained by Microsoft. Typically Typescript is Javascript with types. So that the type error and some of data type related bugs can be resolved . It is highly useful in large projects. Why TypeScript? …
Different ways to create Date in JavaScript.
Learn about Date object in JavaScript To get the current time and date create a Date object without any arguments. var now = new Date(); log(now) // Tue Mar 12 2019 21:14:43 GMT+0530 (India Standard Time) There are many ways of creating a Date object Passing milliseconds as arguments If there is single argument and …
Continue reading “Different ways to create Date in JavaScript.”
Understand filter in javascript.
Javascript filter method. filter() is used to filter the array and creates a new array with the elements which satisfy the condition provided as predicate function . filter method takes a predicate( predicate is commonly understood to be a Boolean-valued function P: X→ {true, false}) as argument , to test each element of the array satisfy condition …
Get keys of the object in javascript
Object.keys() method can be used to get the keys of the object. We get the keys in same order as we get in the normal for..in loop It returns an array filled with the keys of the object. // array var num = [1 , 2, 3];console.log(Object.keys(num)); // [‘0’, ‘1’, ‘2’] // objectvar obj = …
The correct way to delete an object and its referring objects in javascript .
Let’s create an object let obj1 = { name : “Stark”, age : 23} Create another variable with the value referring to the obj1 let obj2 = obj1; Now we know that whatever operation we do on obj1 alters the value in obj2 and vice versa. obj1.job = “superhero”; obj1 // {name: “Stark”, age: 23, …
Continue reading “The correct way to delete an object and its referring objects in javascript .”