Found 9053 Articles for Front End Technology

How to force Chrome's script debugger to reload JavaScript?

Govinda Sai
Updated on 21-Feb-2020 12:43:45

3K+ Views

To force Google Chrome’s script debugger to reload JavaScript, follow the below steps −Open Dev ToolsClick on the Sources tabFind your script / image / fileCheck the right panel to see if your file is up to dateIf the file is not up to date, then −Right-click the resource in the left panel and choose 'Open Link in New Tab'Force a reload of the resource with CTRL+F5

How to use an HTML button to call a JavaScript function?

Abhishek Kumar
Updated on 06-Sep-2023 21:05:15

46K+ Views

We use the onclick event attribute property of the HTML button to call a JavaScript function. The JavaScript code provided in the onclick attribute executes when the button is clicked. There are various attributes provided with the button tag in HTML that allows us to customize the button’s functionality and also let us decide how and what the button triggers. Approach 1: Using the onclick event in JavaScript The onclick event of the button element expects JavaScript code that is triggered when the button is clicked upon. So we put the function that needs to be called in the onclick ... Read More

Does JavaScript have a standard for commenting functions?

Sravani Alamanda
Updated on 26-Aug-2022 14:42:50

176 Views

Comments are used to explain the code flow and want to prevent the code from executing. In JavaScript, there are two types of comments. One is single-line comments, used to comment on the single-line code to prevent the code from executing or to explain the code. Another one is multi-line comments, used to comment on blocks of code to prevent the code from the execution or to explain code that is added in or code. By adding comments, we will give clarity to other developers also why code is added and what that particular code will do. Commented code will ... Read More

How can I check if a JavaScript function is defined?

Sravani S
Updated on 23-Jun-2020 06:48:39

204 Views

To check if a JavaScript function is defined or not, checks it with “undefined”.ExampleYou can try to run the following example to check for a function is defined or not in JavaScript −                    function display() {             alert("Demo Text!");          }          if ( typeof(display) === 'undefined') {             document.write('undefined');          } else {             document.write("Function is defined");          }          

What is the best way to do optional function parameters in JavaScript?

Nishtha Thakur
Updated on 23-Jun-2020 06:49:42

169 Views

To include optional function parameters in JavaScript, you can try the following,function myFunc(a, b = 0) {    // function body }ExampleYou can try to run the following code to learn how to include optional function parameters −                    // default is set to 1          function inc(val1, inc = 1) {             return val1 + inc;          }                    document.write(inc(10,10));          document.write("");          document.write(inc(10));          

How to create many Javascript variables in a single statement?

Abhishek Kumar
Updated on 21-Sep-2022 07:43:33

6K+ Views

We can create many JavaScript variables in a single statement using the var, let, and const keywords that are used for declaring variables in JavaScript. Instead of declaring every variable individually, we can chain many variables together with commas (, ) in a single statement. Since JavaScript is a loosely typed language, variables of many data types can be declared in the same sentence as well. Syntax var variable1 = value1, variable2 = value2, variable3 = value3; Here, var is the keyword used for declaring the variables viz: variable1, variable2, variable3 and assigning them the respective values. Example 1 ... Read More

Where can I find documentation on formatting a date in JavaScript?

Krantik Chavan
Updated on 23-Jun-2020 06:50:58

37 Views

The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below −new Date( ) new Date(milliseconds) new Date(datestring) new Date(year, month, date[, hour, minute, second, millisecond ])The following method is used to Manipulate Dates in JavaScript −Sr.NoMethod & Description1Date()Returns today's date and time2getDate()Returns the day of the month for the specified date according to local time.3getDay()Returns the day of the week for the specified date according to local time.4getFullYear()Returns the year of the specified date according to local time.5getHours()Returns the hour in the specified date according to local ... Read More

How do you launch the JavaScript debugger in Google Chrome?

Abhinaya
Updated on 23-Jun-2020 06:40:20

194 Views

To launch JavaScript debugger in Google Chrome, try any of the following ways,Press Ctrl + Shift + JGo to Settings and click More Tools. After that, click Developer Tools.For more, refer the official website of  Chrome Dev Tool,

How to execute a JavaScript function using its name in a variable?

Shubham Vora
Updated on 23-Aug-2022 09:15:40

306 Views

What is a function in JavaScript? The JavaScript equivalent of a process is a function. A process is a series of instructions for carrying out a task or calculating a value. However, a process must accept input and produce a result to be considered a function. Additionally, there should be a clear connection between the input and the output. Follow the syntax below to define a function This tutorial will guide you to learn the way to execute a JavaScript function using its name in a variable. Syntax function functionName( param1, param2, param3 ) { //code } ... Read More

How do I get started with Node.js?

Anvi Jain
Updated on 23-Jun-2020 06:41:12

117 Views

To get started with Node.js, you need to first set its environment. If you are still willing to set up your environment for Node.js, you need the following two software available on your computer, (a) Text Editor and (b) The Node.js binary installable.Let’s see how to install Node.js binary distribution on Windows. Download the latest version of Node.js installable archive file from Node.js official website.Use the MSI file and follow the prompts to install the Node.js. By default, the installer uses the Node.js distribution in “C:\Program Filesodejs”. The installer should set the “C:\Program Filesodejs\bin” directory in the window's PATH environment variable. ... Read More

Advertisements