- 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
Found 6704 Articles for Javascript
4K+ Views
To add line breaks to JavaScript alert, use “\r”. In the following example, we will see how to display text in JavaScript alert.Example Live Demo function DisplayAlert() { var newLine = "\r" var msg = "Showing how to add line break." msg += newLine; msg += "Line Break can be easily added in JavaScript."; msg += newLine; msg += "Simply Easy Learning"; msg+= newLine; msg += "TutorialsPoint.com"; alert(msg); }
2K+ Views
The following are the differences between JavaScript and C++.JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complementary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. It runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.JavaScript is a scripting whereas C++ is a programming language.C++ program is to be compiled and executed, whereas a script in ... Read More
456 Views
Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./* * This is a multiline comment in JavaScript * It is very similar to comments in C Programming */
114 Views
Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./* * This is a multiline comment in JavaScript * It is very similar to comments in C Programming */
211 Views
JavaScript basics include an overview of JavaScript. JavaScript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow a client-side script to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities.VariablesLike many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.Scope of VariablesThe scope of a variable is the region of your program in which it is ... Read More
3K+ Views
JavaScript is a case-sensitive language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.So the identifiers Time and TIME will convey different meanings in JavaScript.NOTE − Care should be taken while writing variable and function names in JavaScript.ExampleThe following example shows JavaScript is a case-sensitive language: My favorite subject var subject, Subject; subject = "Java"; Subject = "Maths"; document.getElementById("demo").innerHTML = subject;
214 Views
A function in JavaScript looks like the following:(function(){...})()A library in JavaScript shows a function, which begins with a semicolon, for example:;(function ) { }The semicolon allows to safely concatenate several JS files into one. This is to serve it faster as one HTTP request.A leading semicolon can also be to protect from preceding code, which may have been improperly closed. A semicolon will definitely prevent this from happening.
3K+ Views
In this tutorial, we will learn to convert a float number to a whole number in JavaScript. The whole number is the number that doesn’t contain the fractional part. For example, 5.22 is the float number containing the fractional part, and the whole number doesn’t contain a decimal part. So, our goal in this tutorial is to remove the fractional part from the number.We can have various methods to cut out the decimal part from the float number to make it whole, and some of them we have discussed here.Using the Math.trunc() and Math.round() MethodsUsing the parseInt() MethodUsing the Bitwise ... Read More
292 Views
In JavaScript, Semicolons are optional. Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements is placed on a separate line. It is a good programming practice to use semicolons.In JavaScript, use a semi-colon after a statement. Let’s see an example of a variable assignment:var s = function() { alert("Hello World!"); };However, semicolons aren’t necessary for the following function declarations:function() { alert("Hello World!"); };
To Continue Learning Please Login
Login with Google