Front End Technology Articles

Page 527 of 652

How to fix problems related to the JavaScript Void 0 Error?

Arjun Thakur
Arjun Thakur
Updated on 16-Jun-2020 2K+ Views

JavaScript void is an error, which can be seen on the web browser. This happened when a user blocks JavaScript coding on the web browser. This gives the void error when an attempt is made to run.The fix is to enable JavaScript. Let us see how to enable it in Firefox web browser −Open Firefox web browser and click Options. After clicking, you will reach the Settings. Here, click the Content tab as shown below −Now, check the box to enable JavaScript. After enabling, click the “Ok” button to save the settings.In newer versions of Firefox, you will get JavaScript ...

Read More

How to add a YouTube Video to your Website?

Fendadis John
Fendadis John
Updated on 16-Jun-2020 905 Views

To add a YouTube Video to your website, you need to embed it. To embed a video in an HTML page, use the element. The source attribute included the video URL. For the dimensions of the video player, set the width and height of the video appropriately.The Video URL is the video embed link. The video we will be embedding our example will be YouTube.To get the embed link, go to a YouTube Video and click embed as shown below. You will get a link fro embed here −You can try to run the following code to learn how ...

Read More

How to Scroll to the top of the page using JavaScript/ jQuery?

Anjana
Anjana
Updated on 16-Jun-2020 304 Views

ExampleLive Demo                    $("a").click(function() {             $("html, body").animate({ scrollTop: 0 }, "slow");             return false;          });             TOP OF PAGE             This is demo text.       This is demo text.       This is demo text.       This is demo text.       This is demo text.       This is demo text.       This is ...

Read More

What is the difference between getter and setter in JavaScript?

Akshaya Akki
Akshaya Akki
Updated on 16-Jun-2020 1K+ Views

GetterWhen a property is accessed, the value gets through calling a function implicitly. The get keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.SetterWhen a property is set, it implicitly calls a function and the value is passed as an argument. With that, the return value is set to the property itself. The set keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.ExampleHere’s an example showing how to implement both getter and setterLive Demo                   ...

Read More

How to delete a setter using the delete operator in JavaScript?

Manikanth Mani
Manikanth Mani
Updated on 16-Jun-2020 286 Views

To delete a setter using the delete operator, use the delete keyword. Here’s how you can delete −delete obj.nameExampleYou can try to run the following code to learn how to delete a setterLive Demo                    var department = {             deptName: "Marketing",             deptZone: "North",             deptID: 101,             get details() {                return "Department Details" + "Name: " + this.deptName + " Zone: " ...

Read More

How to define getter and setter functions in JavaScript?

Ayyan
Ayyan
Updated on 16-Jun-2020 353 Views

GetterWhen a property is accessed, the value gets through calling a function implicitly. The get keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.SetterWhen a property is set, it implicitly call a function and the value is passed as an argument. With that the return value is set to the property itself. The set keyword is used in JavaScript. An identifier, either a number or a string is allowed for set.ExampleHere’s an example showing how to implement both getter and setterLive Demo                   ...

Read More

What are the latest operators added to JavaScript?

Ayyan
Ayyan
Updated on 16-Jun-2020 143 Views

The latest operators added to JavaScript are spread operator and rest.Rest operatorWith rest parameter, you can represent number of arguments as an array. ES6 brought rest parameter to ease the work of developers. For arguments objects, rest parameters are indicated by three dots … and preceds a parameter.ExampleLet’s see the following code snippet to define rest parameter                    function addition(…numbers) {             var res = 0;             numbers.forEach(function (number) {                res += number;   ...

Read More

Usage of rest parameter and spread operator in JavaScript?

Anjana
Anjana
Updated on 16-Jun-2020 373 Views

Rest ParameterWith rest parameter, you can represent a number of arguments as an array. ES6 brought rest parameter to ease the work of developers. For arguments objects, rest parameters are indicated by three dots … and precedes a parameter.Let’s see the following code snippet to define rest parameter −                    function addition(…numbers) {             var res = 0;             numbers.forEach(function (number) {                res += number;             });     ...

Read More

How to handle Geolocation errors in HTML5?

Krantik Chavan
Krantik Chavan
Updated on 16-Jun-2020 1K+ Views

HTML5 Geolocation API lets you share your location with your favorite websites. A JavaScript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.Geolocation is complicated, and it is very much required to catch any error and handle it gracefully.The geolocations methods getCurrentPosition() and watchPosition() make use of an error handler callback method which gives PositionError object. This object has following two properties −PropertyTypeDescriptionCodeNumberContains a numeric code for the error.messageStringContains a numeric code for the error.The following table describes the possible ...

Read More

What is for each...in a statement in JavaScript?

Nikitha N
Nikitha N
Updated on 16-Jun-2020 201 Views

The for each...in loop iterates a variable overall value of the properties of objects. Note − The “for…each..in” is now deprecated. Do not use. SyntaxHere’s the syntax −for each (variablename in object) {    statement or block to execute }ExampleHere’s an example, which will not run on any of the web browsers, since “for each..in” is now deprecated −                    var myObj = {myProp1:30, myProp2: 40};          var sum = 0;          for each (var value in myObj) {             sum += value;          }          document.write(sum);          

Read More
Showing 5261–5270 of 6,517 articles
« Prev 1 525 526 527 528 529 652 Next »
Advertisements