
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Front End Technology Articles - Page 472 of 860

8K+ Views
To test if a letter in a string is uppercase or lowercase using javascript, you can simply convert the char to its respective case and see the result.Examplefunction checkCase(ch) { if (!isNaN(ch * 1)){ return 'ch is numeric'; } else { if (ch == ch.toUpperCase()) { return 'upper case'; } if (ch == ch.toLowerCase()){ return 'lower case'; } } } console.log(checkCase('a')) console.log(checkCase('A')) console.log(checkCase('1'))OutputThis will give the output −lower case upper case ch is numeric

1K+ Views
JS frameworks are JavaScript code libraries that have pre-written code to use for routine programming features and tasks. It is literally a framework to build websites or web applications around.For example, in plain JS, you have to manually update the DOM using DOM APIs for setting styles updating content, etc.JS frameworks can help automate this repetitive task using features like 2-way binding and templating.Frameworks have their own way of doing things. For example, Angular is a popular JS framework that comes with many features like dependency injection, routing, etc and has its own way of building an application using it. ... Read More

329 Views
You can use 2 properties, clientHeight and offsetHeight to get the height of the div.clientHeight includes padding of the div.offsetHeight includes padding, scrollBar, and borders of the div.ExampleFor example, if you have the following HTML −You can get the height using −const height = document.querySelector('#myDiv').offsetHeight console.log(height)OutputThis will give the output −400

13K+ Views
The HTML element is represented by the Div Object in the HTML DOM. When styling other HTML elements with CSS or with JavaScript, this tag is used to indicate the container for those elements. The default container for flow content in HTML is the div element. It doesn't affect the content or layout until it is CSS-styled in some way. The height of the div element can be known in many ways. These ways are discussed in this article. Using offsetHeight The offsetHeight is a property which returns the height of the element in pixels. Syntax The syntax of ... Read More

265 Views
To get a subset of object's properties and create a new object out of those properties, use object destructuring and property shorthand. For example, You have the following object −Exampleconst person = { name: 'John', age: 40, city: 'LA', school: 'High School' }And you only want the name and age, you can create the new objects using −const {name, age} = person; const selectedObj = {name, age}; console.log(selectedObj);OutputThis will give the output −{ name: 'John', age: 40 }

311 Views
To get a subset of object's properties and create a new object out of those properties, use object destructuring and property shorthand. For example, You have the following object −Exampleconst person = { name: 'John', age: 40, city: 'LA', school: 'High School' }And you only want the name and age, you can create the new objects using −const {name, age} = person; const selectedObj = {name, age}; console.log(selectedObj);OutputThis will give the output −{ name: 'John', age: 40 }

131 Views
Nothing. They can get to V8 speed if proper investments are made in optimizing those language engines as are made for JS by Google in the V8 project.This is all really a matter of how much push is provided to the language by sponsoring organizations to further the development and optimization effort on these languages.

206 Views
The parseInt function available in JavaScript has the following signature −SyntaxparseInt(string, radix);Where the parameters are the following −string − The value to parse. If this argument is not a string, then it is converted to one using the ToString method. Leading whitespace in this argument is ignored.radix − An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string.So we can pass the string and the radix and convert any number with base from 2 to 36 to integer using this method. For example, Exampleconsole.log(parseInt("100", 10)) console.log(parseInt("10", 8)) console.log(parseInt("101", 2)) console.log(parseInt("2FF3", 16)) ... Read More

808 Views
Arrays can be compared in 2 ways −They refer to the same array object in memory.They may refer to different objects but their contents are all equal.ExampleFor case 1, jasmine provides the toBe method. This checks for reference. For example, describe("Array Equality", () => { it("should check for array reference equility", () => { let arr = [1, 2, 3]; let arr2 = arr // Runs successfully expect(arr).toBe(arr2); // Fails as references are not equal expect(arr).toBe([1, 2, 3]); }); });OutputThis ... Read More

3K+ Views
In modern browsers, if a DOM Element is removed, its listeners are also removed from memory in javascript.Note that this will happen ONLY if the element is reference-free. Or in other words, it doesn't have any reference and can be garbage collected. Only then its event listeners will be removed from memory.