Found 6685 Articles for Javascript

What are the basic rules for JavaScript parameters?

Shubham Vora
Updated on 15-Nov-2022 11:09:40

338 Views

In this tutorial, let us discuss the basic rules for JavaScript parameters. A JavaScript function is a code that performs a particular task. The function parameters are the name list in the function definition. Parameters are also known as formal parameters or formal arguments. We can follow the syntax below to declare parameters. Syntax function functionName(param1, param2) { } When there is no value for a parameter, a default value comes in place. Rules Declare the default parameters as the final ones to avoid an error. The JavaScript function definition does not specify a parameter type. The JavaScript ... Read More

How to setup Video.js with JavaScript?

Prince Yadav
Updated on 04-Apr-2023 13:57:26

1K+ Views

In this tutorial, we're going to learn how to set up video.us using JavaScript. We'll also have a look at a few examples for better understanding. First of all, Video-js is a very popular and easy-to-use modern web video player that has been built up on HTML5 and it provides better features and functionality for a web video player. It supports a variety of video playback formats - both the standard HTML5 formats also and the modern formats like Youtube, Vimeo, and Flash also. On top of that - it works with almost all the display sizes like Desktops, mobiles, ... Read More

How to use nested for loop in JavaScript?

Abhishek Kumar
Updated on 10-Nov-2022 09:02:25

11K+ Views

We use the for loop statement of JavaScript for repeating a set of statements inside the loop body a specified number of times. A nested for loop, as the name suggests, is made up of more than one for loop one nested inside of the other. This allows us to loop over multidimensional data structures such as matrices. The nested for loop in JavaScript A simple for loop executes a specified number of times depending on the initialization value and the terminating condition. A nested for loop on the other hand, resides one or more for loop inside an outer ... Read More

How to Create and Save text file in JavaScript?

Shubham Vora
Updated on 31-Oct-2023 12:50:40

92K+ Views

In this tutorial, we will learn to create and save the text file in JavaScript. Sometimes, developers need to get texts or content from the user and allow users to store content in a text file and allow the file to download to the local computer. Many JavaScript libraries are available to achieve our goal, but we have used the best two libraries in this tutorial to create and save the text file. Create a text file using custom text and save it to a local computer We will use normal JavaScript operations to create and save the text file ... Read More

Get the size of the screen, current web page and browser window in JavaScript

AmitDiwan
Updated on 01-Nov-2022 13:07:30

1K+ Views

To get the current screen size of a web page, use the window.inner. We can also use the window.outerWidth and window.outerHeight as shown below to get the outer width and height of the web browser windows. We will see two examples − Get the Inner Width and Height Get the Outer Width and Height Get the Inner Width and Height To get the current screen size of a web page, use the window.innerWidth and window.innerHeight − var wd = window.innerWidth; var ht = window.innerHeight; Example Let us see an example − DOCTYPE html> ... Read More

How to straighten an Image with animation using FabricJS?

Rahul Gurung
Updated on 28-Oct-2022 07:53:12

157 Views

In this tutorial, we are going to learn how to straighten an Image with animation using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to straighten an Image with animation, we use the fxStraighten method. Syntax fxStraighten(callbacks: Object): fabric.Object Parameters callbacks − This parameter is an Object with callback functions which can be used to change certain properties related to the animation. Using the straighten method Example ... Read More

How to straighten an Image object using FabricJS?

Rahul Gurung
Updated on 28-Oct-2022 07:50:24

234 Views

In this tutorial, we are going to learn how to straighten an Image object using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to straighten an Image object, we use the straighten method. Syntax straighten(): fabric.Object Passing the angle property a value without using the straighten method Example Let’s see a code example to see how our Image object looks when the straighten method is not used. The straighten ... Read More

How to set the position of Image from top using FabricJS?

Rahul Gurung
Updated on 28-Oct-2022 07:48:44

468 Views

In this tutorial, we are going to learn how to set the position of Image from top using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to set the position of Image from top, we use the top property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { top: Number }: Object, callback: function) Parameters element − This parameter accepts HTMLImageElement, HTMLCanvasElement, HTMLVideoElement or String ... Read More

How to set the position of Image from left using FabricJS?

Rahul Gurung
Updated on 28-Oct-2022 07:47:06

756 Views

In this tutorial, we are going to learn how to set the position of Image from left using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to set the position of Image from left, we use the left property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { left: Number }: Object, callback: function) Parameters element − This parameter accepts HTMLImageElement, HTMLCanvasElement, HTMLVideoElement or String ... Read More

How to set the padding of Image using FabricJS?

Rahul Gurung
Updated on 28-Oct-2022 07:45:09

326 Views

In this tutorial, we are going to learn how to set the padding of Image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to set the padding of Image, we use the padding property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { padding: Number }: Object, callback: function) Parameters element − This parameter accepts HTMLImageElement, HTMLCanvasElement, HTMLVideoElement or String which denotes the image ... Read More

Advertisements