Role of Throw Statement in JavaScript

Jennifer Nicholas
Updated on 23-Jun-2020 07:25:09

203 Views

Use the throw statement to raise your built-in exceptions or your customized exceptions. Later these exceptions can be captured and you can take appropriate action.ExampleYou can try to run the following code to implement throw statement −                                         Click the following to see the result:                          

Add Node After Given Node in Linked List using C#

Chandu yadav
Updated on 23-Jun-2020 07:24:57

339 Views

Set a LinkedList and add elements.string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Firstly, add a new node at the end.var newNode = list.AddLast("Emma");Now, use the AddAfter() method to add a node after the given node.list.AddAfter(newNode, "Matt");The following is the complete code.Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       string [] students = {"Beth", "Jennifer", "Amy", "Vera"};       LinkedList list = new LinkedList(students);       foreach (var stu in list) {          Console.WriteLine(stu);       }       // ... Read More

Access Document Properties Using Legacy DOM Method in JavaScript

Srinivas Gorla
Updated on 23-Jun-2020 07:24:34

206 Views

To access document properties using Legacy DOM method in JavaScript, you can try to run the following code −Example           Document Title                                     This is main title       Click the following to see the result:                                                        

Determine Difference in Hours Between Two Dates in C#

Samual Sam
Updated on 23-Jun-2020 07:24:08

11K+ Views

Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, get the difference between two dates.TimeSpan ts = date2 - date1;Get the result i.e. the difference in hours.ts.TotalHoursLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20);       DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);       TimeSpan ts = date2 - date1;       Console.WriteLine("No. of Hours (Difference) = {0}", ts.TotalHours);    } }OutputNo. of Hours (Difference) = 794.984722222222

How Objects are Organized in a Web Document

Anvi Jain
Updated on 23-Jun-2020 07:24:03

260 Views

The Objects are organized in a hierarchy. This hierarchical structure applies to the organization of objects in a Web document.Window object − Top of the hierarchy. It is the utmost element of the object hierarchy.Document object − Each HTML document that gets loaded into a window becomes a document object. The document contains the contents of the page.Form object − Everything enclosed in the ... tags sets the form object.Form control elements − The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes.The following is a simple hierarchy of a ... Read More

Document Methods Supported by Legacy DOM

Priya Pallavi
Updated on 23-Jun-2020 07:23:30

144 Views

The following is the list of document methods supported by Legacy DOM −Sr.NoProperty & Description1clear( )Deprecated − Erases the contents of the document and returns nothing.Ex − document.clear( )2close( )Closes a document stream opened with the open( ) method and returns nothing.Ex − document.close( )3open( )Deletes existing document content and opens a stream to which new document contents may be written. Returns nothing.Ex − document.open( )4write( value, ...)Inserts the specified string or strings into the document currently being parsed or appends to document opened with open( ). Returns nothing.Ex − document.write( value, ...)5writeln( value, ...)Identical to write( ), except that ... Read More

C# Console WindowHeight Property

Samual Sam
Updated on 23-Jun-2020 07:22:58

244 Views

The WindowHeight property gets or sets the height of the console window.Declare a variable.int height;Now, get the height of the current window.height = Console.WindowHeight;The following is the complete example −Example Live Demousing System; using System.Numerics; using System.Globalization; class Demo {    static void Main() {       int height;       height = Console.WindowHeight;       Console.WriteLine("Current window height = "+height);    } }OutputCurrent window height = 0

Calculate Minutes Between Two Dates in C#

George John
Updated on 23-Jun-2020 07:22:38

21K+ Views

Firstly, set the two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, calculate the difference between two dates.TimeSpan ts = date2 - date1;To calculate minutes.ts.TotalMinutesLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20);       DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);       TimeSpan ts = date2 - date1;       Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes);    } }OutputNo. of Minutes (Difference) = 47699.0833333333

Document Properties Accessible Using Legacy DOM

Nishtha Thakur
Updated on 23-Jun-2020 07:22:35

155 Views

The following are the document properties which can be accessed using Legacy DOM −Sr.NoProperty & Description1alinkColorDeprecated − A string that specifies the color of activated links.Ex − document.alinkColor2anchors[ ]An array of Anchor objects, one for each anchor that appears in the documentEx − document.anchors[0], document.anchors[1] and so on3applets[ ]An array of Applet objects, one for each applet that appears in the documentEx − document.applets[0], document.applets[1] and so on4bgColorDeprecated − A string that specifies the background color of the document.Ex − document.bgColor5cookieA string-valued property with special behavior that allows the cookies associated with this document to be queried and set.Ex − ... Read More

Get the Difference Between Two Dates in Seconds using C#

karthikeya Boyini
Updated on 23-Jun-2020 07:22:16

7K+ Views

Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25);Now calculate the difference between two dates.TimeSpan ts = date2 - date1;Move further and calculate the difference in seconds.ts.TotalSecondsLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20);       DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25);       TimeSpan ts = date2 - date1;       Console.WriteLine("No. of Seconds (Difference) = {0}", ts.TotalSeconds);    } }OutputNo. of Seconds (Difference) = 10745

Advertisements