Articles on Trending Technologies

Technical articles with clear explanations and examples

How do I clear the usage of setInterval()?

George John
George John
Updated on 23-Jun-2020 240 Views

The setInterval() method is used evaluate an expression at specified intervals. This function calls function after every duration milliseconds. This goes for unlimited times. Let’s see an example −It triggers alert(‘Hello’) after every 2000 milliseconds, not only once.setInterval(function() { alert('Hello');}, 2000);To clear the usage of setInterval(), use the window.clearInterval() and set the parameter as the ID, likewindow.setInterval();

Read More

Does use of anonymous functions affect performance?

Daniol Thomas
Daniol Thomas
Updated on 23-Jun-2020 386 Views

The usage of anonymous functions affect performance is the sense, you need to create a new function object at each iteration. Anonymous functions are always loaded using a variable name. Anonymous, as the name suggests, allows creating a function without any names identifier. It can be used as an argument to other functions. Call them using a variable name −ExampleThis is how JavaScript anonymous functions can be used −var func = function() {    alert(‘This is anonymous'); } func();Here’s an example −//anonymous function var a = function() {    return 5; }

Read More

Is their JavaScript scroll event for iPhone/iPad?

Abhinanda Shri
Abhinanda Shri
Updated on 23-Jun-2020 415 Views

Yes, iOS capture onscroll events for a scroll. This is called one-finger events. What the user is tapping or touching decides whether an event is generated or not.Here is panning gesture,Image credit − AppleIt can also be touch and hold gesture,Image credit − Apple

Read More

How to use the GetType method of array class in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 3K+ Views

The GetType() method of array class in C# gets the Type of the current instance (Inherited from Object).To get the type.Type tp = value.GetType();In the below example, we are checking the int value using the type.if (tp.Equals(typeof(int))) Console.WriteLine("{0} is an integer data type.", value)The following is the usage of GetType() method in C#.Exampleusing System public class Program {    public static void Main() {       object[] values = { (int) 100, (long) 17111};       foreach (var value in values) {          Type tp = value.GetType();          if (tp.Equals(typeof(int)))     ...

Read More

How to use the Main() method in C#?

George John
George John
Updated on 23-Jun-2020 837 Views

A main method is static since it is available to run when the C# program starts. It is the entry point of the program and runs without even creating an instance of the class.The Main method states what the class does when executed and instantiates other objects and variables.The following shows how to add a Main() method.Exampleusing system; namespace demo {    class helloworld {       static void main(string[] args) {          console.writeline("hello world");          console.readkey();       }    } }As you can see in the above example.static void Main(string[] ...

Read More

How to set the brightness and contrast of an image with JavaScript?

Sharon Christine
Sharon Christine
Updated on 23-Jun-2020 4K+ Views

To set the brightness, use the brightness property and for contrast, use the contrast property.ExampleYou can try to run the following code to use image filters with JavaScript −Live Demo           Click below to change the brightness and contrast of the image.       Edit Image                      function display() {             document.getElementById("myID").style.filter = "brightness(50%)";             document.getElementById("myID").style.filter = "contrast(50%)";          }          

Read More

How to set the page-break behavior after an element with JavaScript?

Nikitha N
Nikitha N
Updated on 23-Jun-2020 901 Views

Use the pageBreakAfter property in JavaScript to set the page-break behavior after an element. Use the always property for page after an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior after an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This if footer text.       Set page-break                function display() {             document.getElementById("myFooter").style.pageBreakAfter = "always";          }          

Read More

How to set the page-break behavior inside an element with JavaScript?

Anvi Jain
Anvi Jain
Updated on 23-Jun-2020 3K+ Views

Use the pageBreakInside property in JavaScript to set the page-break behavior inside an element. Use the auto property to insert page break inside an element. Use auto or avoid property value to automatically insert page break inside an element, if needed, or avoid a page break, respectively.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior inside an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This ...

Read More

How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?

Srinivas Gorla
Srinivas Gorla
Updated on 23-Jun-2020 157 Views

Use the orphans property in JavaScript to set the minimum number of lines for an element that should be left at the bottom of a page when a page break occurs inside an element with JavaScript.You can return the orphans property like this −var res = object.style.orphansSet the orphans property like this −object.style.orphans = 'number|initial|inherit'The following are the property values shown above −number − Specify the minimum number of visible lines.Initial − Set property to its defaultInherit − Inherits property from the parent element

Read More

How to use the directory class in C#?

Ankith Reddy
Ankith Reddy
Updated on 23-Jun-2020 553 Views

The Directory class in C# is used to manipulate the directory structure. It has methods to create, move, remove directories.The following are some of the methods of the Directory class.Sr.No.Method & Description1CreateDirectory(String)Creates all directories and subdirectories in the specified path2Delete(String)Deletes an empty directory3Exists(String)Whether the given path refers to an existing directory4GetCreationTime(String)Gets the creation date and time of a directory.5GetCurrentDirectory()Gets the current working directory6GetFiles(String)Let us learn about the usage of GetFiles() method in Directory class. It displays all the files in the specified directory.Exampleusing System; using System.IO; class Program {    static void Main() {       // Get all ...

Read More
Showing 48371–48380 of 61,248 articles
Advertisements