- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Firstly, set a tuplevar tuple = Tuple.Create(100, 200, 300);Now, pass the tuple as a method parameter −Show(tuple);Here’s our method.static void Show(Tuple tuple)Now call the tuple values one by one as shown below −Example Live Demousing System; public class Program { public static void Main() { var tuple = Tuple.Create(100, 200, 300); Show(tuple); } static void Show(Tuple tuple) { Console.WriteLine(tuple.Item1); Console.WriteLine(tuple.Item2); Console.WriteLine(tuple.Item3); } }Output100 200 300
The following is our array −double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7};To get the first element, use the First() method.myArr.AsQueryable().First();Let us see the complete code −Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo { static void Main() { double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7}; double res = myArr.AsQueryable().First(); Console.WriteLine(res); } }Output20.5
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
Use the Convert.ToInt64() method to convert Decimal to Int64 (long) in C#.Let’s say we have a decimal variable.decimal d = 310.23m;Now to convert it to Int64, use the Convert.ToInt64() method.long res; res = Convert.ToInt64(d);Let us see another example −Example Live Demousing System; class Demo { static void Main() { decimal d = 190.66m; long res; res = Convert.ToInt64(d); Console.WriteLine("Converted Decimal '{0}' to Int64 value {1}", d, res); } }OutputConverted Decimal '190.66' to Int64 value 191
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));
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"); }
To debug JavaScript in Visual Studio, follow the below-given steps −Open Visual StudioSelect your project to be debugged in Solution Explorer.Right Click and select Browse With, and set a default browser.Now, go to START and type Internet Options.Above, uncheck both the options for Disable script debugging.Click Apply, and then Ok.Now set breakpoints in your JS file.After that press the debug button in Visual Studio.
The following are some of the common HTML events supported by JavaScript −AttributeValueDescriptiononclickscriptTriggers on a mouse clickoncontextmenuscriptTriggers when a context menu is triggeredondblclickscriptTriggers on a mouse double-clickondragscriptTriggers when an element is draggedondragendscriptTriggers at the end of a drag operationondragenterscriptTriggers when an element has been dragged to a valid drop targetondragleavescriptTriggers when an element is being dragged over a valid drop targetondragoverscriptTriggers at the start of a drag operationondragstartscriptTriggers at the start of a drag operationondropscriptTriggers when dragged element is being droppedondurationchangescriptTriggers when the length of the media is changed
JavaScript Identifiers are names given to variables, functions, etc. It is the same as identifiers in other programming languages like C, C++, Java, etc. Let’s see identifiers for variable names.The following are legal variable names −val val1 resultWhile naming your variables in JavaScript, keep the following rules in mind.You should not use any of the JavaScript reserved keywords as a variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid.JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or an underscore character. For ... Read More
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