JavaScript was originally named Mocha but was renamed LiveScript and then JavaScript. It is a lightweight, interpreted programming language designed for creating network-centric and browser-based applications. JavaScript can be used for client-side scripting through features like popup boxes and event handling, and for server-side scripting by running JavaScript code on the server with Node.js. It includes basic datatypes, operators, control flows, and built-in objects for manipulating the browser and its DOM.
JavaScript Arithmetic Operators
Arithmetic operators are used to perform arithmetic between variables and/or values.
JavaScript Assignment Operators
Assignment operators are used to assign values to JavaScript variables.
JavaScript String Operators
The + operator, and the += operator can also be used to concatenate (add) strings.
Comparison Operators
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Conditional (Ternary) Operator
The conditional operator assigns a value to a variable based on a condition.
Logical Operators
Logical operators are used to determine the logic between variables or values.
JavaScript Bitwise Operators
Bit operators work on 32 bits numbers. Any numeric operand in the operation is converted into a 32 bit number. The result is converted back to a JavaScript number.
The delete Operator
The delete operator deletes a property from an object:
JavaScript Arithmetic Operators
Arithmetic operators are used to perform arithmetic between variables and/or values.
JavaScript Assignment Operators
Assignment operators are used to assign values to JavaScript variables.
JavaScript String Operators
The + operator, and the += operator can also be used to concatenate (add) strings.
Comparison Operators
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Conditional (Ternary) Operator
The conditional operator assigns a value to a variable based on a condition.
Logical Operators
Logical operators are used to determine the logic between variables or values.
JavaScript Bitwise Operators
Bit operators work on 32 bits numbers. Any numeric operand in the operation is converted into a 32 bit number. The result is converted back to a JavaScript number.
The delete Operator
The delete operator deletes a property from an object:
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...Edureka!
( ** Full Stack Masters Training: https://www.edureka.co/masters-program/full-stack-developer-training ** )
This PPT on jQuery will help you understand the basics of jQuery and you will also be able to create your own program using jQuery by the end of this PPT.
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This year ECMA International will be ratifying the biggest update to the JavaScript language in its history. In this talk we'll look at key features already appearing in browsers as well as those coming in the near future. We'll also explore how you can begin leveraging the power of ES6 across all browsers today. If you haven't looked at JavaScript recently, you soon realize that a bigger, better world awaits.
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects.
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
What is JavaScript?
JavaScript is a very powerful client-side scripting language. JavaScript is used mainly for enhancing the interaction of a user with the webpage. In other words, you can make your webpage more lively and interactive, with the help of JavaScript. JavaScript is also being used widely in game development and Mobile application development.
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...Edureka!
( ** Full Stack Masters Training: https://www.edureka.co/masters-program/full-stack-developer-training ** )
This PPT on jQuery will help you understand the basics of jQuery and you will also be able to create your own program using jQuery by the end of this PPT.
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This year ECMA International will be ratifying the biggest update to the JavaScript language in its history. In this talk we'll look at key features already appearing in browsers as well as those coming in the near future. We'll also explore how you can begin leveraging the power of ES6 across all browsers today. If you haven't looked at JavaScript recently, you soon realize that a bigger, better world awaits.
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects.
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
What is JavaScript?
JavaScript is a very powerful client-side scripting language. JavaScript is used mainly for enhancing the interaction of a user with the webpage. In other words, you can make your webpage more lively and interactive, with the help of JavaScript. JavaScript is also being used widely in game development and Mobile application development.
ACT Academy provides training in web designing , Graphic Designing, CAD Designing, .NET, JAVA, PHP. We also have advance diploma courses in Web Designing, CAD Designing, Financial Accounting & Graphic Designing with 100% job assurance.
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
1. JavaScript
was developed by Netscape, was originally named Mocha but soon was renamed LiveScript
In late 1995 Live Script became a joint venture of Netscape and Sun Microsystems, then
renamed as JavaScript.
What is JavaScript
JavaScript is a lightweight, interpreted programming language
Designed for creating network-centric applications
Complementary to and integrated with Java
Complementary to and integrated with HTML
Open and cross-platform
JavaScript is loosely based on Java and it is built into all the major modern browsers.
2. JavaScript can be divided into three parts:
1. the core JavaScript
2. client side JavaScript
3. server side JavaScript
the core JavaScript : is the heart of the language, it includes operators,
expressions, statements, and subprograms.
client side JavaScript: is a collection of objects that support the control of a
browser and interactions with users
Server-side JavaScript : is a collection of objects that make the language useful on a
Web server
3. difference between Java and JavaScript
The two languages are completely unrelated. they could hardly be more different
Java is a object-oriented languages; Java Script is Object-based Language.
Java is strongly typed, while JavaScript is weakly typed.
JavaScript has first-class functions; Java lacks them.
Java is class-based; JavaScript is prototype-based.
Java is distributed as compiled bytecode; JavaScript is distributed in its source
code.
4. JavaScript Syntax
A JavaScript consists of JavaScript statements that are placed within the <script>...
</script> HTML tags in a web page.
The <script> tag alert the browser program to begin interpreting all the text
between these tags as a script.
<script language="JavaScript" type="text/ javascript">
JavaScript code
</script>
It as two important attributes:
language: This attribute specifies what scripting language you are using.
type: This attribute is what is now recommended to indicate the scripting language
in use and its value should be set to "text/javascript".
5. Where to put the java Script
JavaScripts in a page will be executed immediately while the page loads into the
browser.
You can put javascript any where in the document.
Scripts in the header section: scripts to be executed when they are called,or
when an event is trigged.
<html>
<head>
<script type=“text/javascript”>
---------
</script>
</head>
</html>
6. Scripts in the body section: scripts to be executed when the page loads.
<html>
<head>
<body>
<script type=“text/javascript”>
………..
</script>
</body>
</html>
Scripts in both body and header section: you can place an unlimited number of
scripts in your document.
We can also write java script in a separate file with .js extension. To call external
javascript file we use an attribute in script tag that is src.
7. JavaScript Datatypes
JavaScript allows
three primitive data types
1.Numbers eg. 123, 120.50 etc.
2.Strings of text e.g. "This text string" etc.
3.Boolean e.g. true or false.
two trivial data types
1.null
2.undefined
8. JavaScript Variables
Variables is a container for information you want to store.
Rules for variable names
Variable name are case sensitive.
They must begin with letter or underscore character.
should not use any of the JavaScript reserved keyword as variable name.
Declaring a Variables : variable are declared using var keyword.
example: var money;
here semicolon is optional.
You can also create a variable without var statement.
money=100;
9. Assigning value to variable
Var strname=“hello”
OR
Strname=“hello”
Variable Scope
The scope of a variable is the region of your program in which it is defined.
JavaScript variable will have only two scopes.
1. Global Variables: A global variable has global scope which means it is
defined everywhere in your JavaScript code.
2. Local Variables: A local variable will be visible only within a function
where it is defined. Function parameters are always local to that function.
10. JavaScript Reserved Words
They cannot be used as JavaScript variables, functions, methods, loop labels, or any object names
11. Arithmetic Operators supported by JavaScript
+ Adds two operands
- Subtracts second operand from the first
* Multiply both operands
/ Divide numerator by denumerator
% Modulus Operator and remainder of after an integer division .
Comparison Operators supported by JavaScript
==,>,<,>=,=<
Logical Operators supported by JavaScript
&& (Logical AND ),|| (Logical OR),! (Logical NOT)
Bitwise Operators supported by JavaScript
&(Bitwise AND ),|(Bitwise OR), ^ (Bitwise XOR) , ~ (Bitwise NOT)
12. Assignment Operators supported by JavaScript
= , += , -= , *= , /= , %=
Conditional Operator
typeof Operator
The typeof is a unary operator that is placed before its single operand, which
can be of any type. Its value is a string indicating the data type of the operand.
13. Control statements
if statement
Syntax
if (expression){
Statement(s) to be executed if expression is true
}
if...else statement
Syntax
if (expression){
Statement(s) to be executed if expression is true
}else{
Statement(s) to be executed if expression is false
}
14. if...else if... Statement
Syntax
if (expression 1)
{
Statement(s) to be executed if expression 1 is true
}else if (expression 2)
{
Statement(s) to be executed if expression 2 is true
}else if (expression 3)
{
Statement(s) to be executed if expression 3 is true
}else
{
Statement(s) to be executed if no expression is true
16. Java Script Popup Boxes
Alert Box
An alert dialog box is mostly used to give a warning message to the users.
<head>
<script type="text/javascript">
<!--
alert("Warning Message");
//-->
</script>
</head>
17. Confirmation Dialog Box
A confirmation dialog box is mostly used to take user's consent on any option. It
displays a dialog box with two buttons: OK and Cancel.
<script language="javascript">
function respond()
{
var retVal = confirm("are u sure to continue");
if(retVal == true)
{
window.location="../first.html";
}
else{alert("you have canceled the redirection");}
}
</script>
18. Prompt Dialog Box
Prompt bob is often used if you want the user to input a value before entering a
page
<head>
<script type="text/javascript">
<!--
var retVal = prompt(“someText", “defaultvalue");
alert("You have entered : " + retVal );
//-->
</script>
</head>
19. Java Script Functions
The most common way to define a function in JavaScript is by using the function
keyword, followed by a unique function name, a list of parameters (that might be
empty), and a statement block surrounded by curly braces.
<script type="text/javascript">
<!--
function functionname(parameter-list)
{
statements
}
//-->
</script>
A function contain some code that will be executed only by an event or a call to
that function.
21. JavaScript loops
while Loop
while (expression){
Statement(s) to be executed if expression is true
}
do...while Loop
do{
Statement(s) to be executed;
} while (expression);
for Loop
for (initialization; test condition; iteration statement)
{
Statement(s) to be executed if test condition is true
}
for...in Loop
for (variablename in object)
{
statement or block to execute
}
22. Events
Every element on a web page has certain Events which can trigger javascript
functions.
Example of events
1.A mouse clicks
2.A web page loading or an image loading
3.Mouse over a hot spot on the web page
4.selecting an input box in an HTML form
5.submitting an HTML form
6.A key Stroke.
Types of events
1.Window Events(Onload and onunload )
2.Form Events(OnFocus ,onBlur and onChange,onsubmit)
3. Keyboard Events(onkeydown, onkeypress, onkeyup)
4. Mouse Events(onMouseOver and onMouseOut)
23. Onload and onunload events
• The onload and onunload events are trigged when the unters or
leaves the page.
• The onload attribute can be used to check the visitor's browser type
and browser version, and load the proper version of the web page
based on the information.
• Syntax
• <element onload="script">
24. OnFocus ,onBlur and onChange
onFocus: The onfocus attribute fires the moment that the element gets focus.
onBlur: The onblur attribute fires the moment that the element loses focus.
onChange :The onchange attribute fires the moment when the value of the element is
changed.
These events are often used in combination with validation of form fields.
Syntax
<element onfocus="script">
<element onblur="script">
<element onchange="script">
25. onsubmit
The onsubmit attribute fires when a form is submitted.
The onsubmit event is used to validate all form fields before submitting it.
Syntax
<form onsubmit="script">
26. onkeydown, onkeypress, onkeyup
The onkeydown attribute fires when the user is pressing a key.
The onkeypress attribute fires when the user presses a key.
The onkeyup attribute fires when the user releases a key.
syntax
<element onkeydown=" script " onkeypress=" script " onkeyup=" script ">
27. onMouseOver and onMouseOut
The onmouseover attribute fires when the mouse pointer moves over an element.
Syntax
<element onmouseover="script">
The onmouseout attribute fires when the mouse pointer moves out of an element.
syntax
<element onmouseout="script">
29. Arrays
An array is a special variable, which can hold more than one value, at a time.
An array can be defined in three ways.
The following code creates an Array object called myCars:
1:
var myCars=new Array(); // regular array
myCars[0]="Saab";
myCars[1]="Volvo";
myCars[2]="BMW";
2:
var myCars=new Array("Saab","Volvo","BMW");
3:
var myCars=["Saab","Volvo","BMW"];
30. Access an Array
• The following code line:
• document. write(myCars[0]);will result in the following output:
Saab
31. Modify Values in an Array
• To modify a value in an existing array, just add a new value to the
array with a specified index number:
• myCars[0]="Opel";
• Now, the following code line:
• document.write(myCars[0]);
• will result in the following output:
Opel
32. Predefined methods
Join two arrays - concat()
<html>
<body>
<script type="text/javascript">
var parents = ["Jani", "Tove"];
var children = ["Cecilie", "Lone"];
var family = parents.concat(children);
document.write(family);
</script>
</body>
</html>
33. Code for joining three arrays
<html>
<body>
<script type="text/javascript">
var parents = ["Jani", "Tove"];
var brothers = ["Stale", "Kai Jim", "Borge"];
var children = ["Cecilie", "Lone"];
var family = parents.concat(brothers, children);
document.write(family);
</script>
</body>
</html>
34. Join all elements of an array into a string - join()
<html>
<body>
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits.join() + "<br />");
document.write(fruits.join("+") + "<br />");
document.write(fruits.join(" and "));
</script>
</body>
</html>
35. Remove the last element of an array - pop()
<html>
<body>
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits.pop() + "<br />");
document.write(fruits + "<br />");
document.write(fruits.pop() + "<br />");
document.write(fruits);
</script>
</body>
</html>
36. Add new elements to the end of an array - push()
<html>
<body>
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango","ramana"];
document.write(fruits.push("Kiwi") + "<br />");
document.write(fruits.push("Lemon","Pineapple") + "<br />");
document.write(fruits);
</script>
</body>
</html>
37. Reverse the order of the elements in an array - reverse()
<html>
<body>
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits.reverse());
</script>
</body>
</html>
38. Sort an array (alphabetically and ascending) - sort()
<html>
<body>
<script type="text/javascript">
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits.sort());
</script>
</body>
</html>
39. String Object
The String object is used to manipulate a stored piece of text.
String objects are created with new String()
Syntax:
var txt = new String(string);
or more simply:
var txt = string;
40. String Object Properties
Length Returns the length of a string
Return the number of characters in a string
<script type="text/JavaScript">
var txt = "Hello World!";
document.write(txt.length);
</script>
41. String Object Methods
Method
charAt(): Returns the character at the specified index
Example:
Return the first and last character of a string:
<script type="text/javascript">
var str = "Hello world!";
document.write("First character: " + str.charAt(0) + "<br />");
document.write("Last character: " + str.charAt(str.length-1));
</script>
42. charCodeAt():Returns the Unicode of the character at the specified index
Return the Unicode of the first and last character in a string:
<script type="text/javascript">
var str = "Hello world!";
document.write("First character: " + str.charCodeAt(0) + "<br />");
document.write("Last character: " + str.charCodeAt(str.length-1));
</script>
43. concat():Joins two or more strings, and returns a copy of the joined strings
Join two strings:
<script type="text/javascript">
var str1="Hello ";
var str2="world!";
document.write(str1.concat(str2));
</script>
45. indexOf():Returns the position of the first found occurrence of a specified value in
a string
<script type="text/javascript">
var str="Hello world!";
document.write(str.indexOf("d") + "<br />");
document.write(str.indexOf("WORLD") + "<br />");
document.write(str.indexOf("world"));
</script>
46. lastIndexOf():Returns the position of the last found occurrence of a specified value
in a string
<script type="text/javascript">
var str="Hello world!";
document.write(str.lastIndexOf("d") + "<br />");
document.write(str.lastIndexOf("WORLD") + "<br />");
document.write(str.lastIndexOf(“l"));
</script>
47. toLowerCase():Converts a string to lowercase letters
<script type="text/javascript">
var str="Hello World!";
document.write(str.toLowerCase());
</script>
toUpperCase():Converts a string to uppercase letters
<script type="text/javascript">
var str="Hello world!";
document.write(str.toUpperCase());
</script>
48. substr():Extracts the characters from a string, beginning at a specified start
position, and through the specified number of character
<script type="text/javascript">
var str="Hello world!";
document.write(str.substr(3)+"<br />");
document.write(str.substr(3,4));
</script>
49. replace():Searches for a match between a substring (or regular expression) and a
string, and replaces the matched substring with a new substring
<script type="text/javascript">
var str="Visit Microsoft!";
document.write(str.replace("Microsoft", “jntu"));
</script>
50. String HTML Wrapper Methods
The HTML wrapper methods return the string wrapped inside the appropriate
HTML tag.
big() Displays a string using a big font
blink() Displays a blinking string
bold() Displays a string in bold
51. fontcolor() Displays a string using a specified color
fontsize() Displays a string using a specified size
italics() Displays a string in italic
small() Displays a string using a small font
strike() Displays a string with a strikethrough
link() Displays a string as a hyperlink
sub() Displays a string as subscript text
sup() Displays a string as superscript text
53. Math Object
The Math object allows you to perform mathematical tasks.
All properties/methods of Math can be called by using Math as an object, without
creating it.
Syntax:
var x = Math.PI; // Returns PI
var y = Math.sqrt(16); // Returns the square root of 16
54. Math Object Methods
abs(x):Returns the absolute value of x
<script type="text/javascript">
document.write(Math.abs(7.25) + "<br />");
document.write(Math.abs(-7.25) + "<br />");
document.write(Math.abs(null) + "<br />");
document.write(Math.abs("Hello") + "<br />");
document.write(Math.abs(2+3));
</script>
59. log(x):Returns the natural logarithm (base E) of x
<script type="text/javascript">
document.write(Math.log(2.7183) + "<br />");
document.write(Math.log(2) + "<br />");
document.write(Math.log(1) + "<br />");
document.write(Math.log(0) + "<br />");
document.write(Math.log(-1));
</script>
60. max(x,y,z,...,n):Returns the number with the highest value
min(x,y,z,...,n): Returns the number with the lowest value
<script type="text/javascript">
document.write(Math.max(5,10) + "<br />");
document.write(Math.max(0,150,30,20,38) + "<br />");
document.write(Math.max(-5,10) + "<br />");
document.write(Math.max(-5,-10) + "<br />");
document.write(Math.max(1.5,2.5));
</script>
61. Pow(x,y):Returns the value of x to the power of y
<script type="text/javascript">
document.write(Math.pow(0,0) + "<br />");
document.write(Math.pow(0,1) + "<br />");
document.write(Math.pow(1,1) + "<br />");
document.write(Math.pow(1,10) + "<br />");
document.write(Math.pow(7,2) + "<br />");
document.write(Math.pow(-7,2) + "<br />");
document.write(Math.pow(2,4));
</script>
62. random():Returns a random number between 0 and 1
<script type="text/javascript">
//return a random number between 0 and 1
document.write(Math.random() + "<br />");
//return a random integer between 0 and 10
document.write(Math.floor(Math.random()*11));
</script>
63. round(x):Rounds x to the nearest integer
<script type="text/javascript">
document.write(Math.round(0.60) + "<br />");
document.write(Math.round(0.50) + "<br />");
document.write(Math.round(0.49) + "<br />");
document.write(Math.round(-4.40) + "<br />");
document.write(Math.round(-4.60));
</script>
64. sqrt(x):Returns the square root of x
<script type="text/javascript">
document.write(Math.sqrt(0) + "<br />");
document.write(Math.sqrt(1) + "<br />");
document.write(Math.sqrt(9) + "<br />");
document.write(Math.sqrt(0.64) + "<br />");
document.write(Math.sqrt(-9));
</script>
65. Date Object
The Date object is used to work with dates and times.
Date objects are created with new Date().
There are four ways of instantiating a date:
var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
66. Date Object Methods
getDate():Returns the day of the month (from 1-31)
<script type="text/javascript">
var d = new Date();
document.write(d.getDate());
</script>
Return the day of the month from a specific date:
<script type="text/javascript">
var d = new Date("July 21, 1983 01:15:00");
document.write(d.getDate());
</script>
67. getDay():Returns the day of the week (from 0-6)
<script type="text/javascript">
var d = new Date();
document.write(d.getDay());
</script>
68. Return the name of the weekday (not just a number):
<script type="text/javascript">
var d=new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
document.write("Today is " + weekday[d.getDay()]);
</script>
69. getFullYear():Returns the year (four digits)
<script type="text/javascript">
var d = new Date();
document.write(d.getFullYear());
</script>
Return the four-digit year from a specific date:
<script type="text/javascript">
var d = new Date("July 21, 1983 01:15:00");
document.write("I was born in " + d.getFullYear());
</script>
70. getHours():Returns the hour (from 0-23)
<script type="text/javascript">
var d = new Date();
document.write(d.getHours());
</script>
Return the hour from a specific date and time:
<script type="text/javascript">
var d = new Date("July 21, 1983 01:15:00");
document.write(d.getHours());
</script>
71. getMilliseconds():Returns the milliseconds (from 0-999)
<script type="text/javascript">
var d = new Date();
document.write(d.getMilliseconds());
</script>
Return the milliseconds from a specific date and time:
<script type="text/javascript">
var d = new Date("July 21, 1983 01:15:00");
document.write(d.getMilliseconds());
</script>
72. es():Returns the minutes (from 0-59)
h():Returns the month (from 0-11)
ds():Returns the seconds (from 0-59)
:Returns the number of milliseconds since midnight Jan 1, 1970
oneOffset():Returns the time difference between GMT and local time, in minutes
ate():Returns the day of the month, according to universal time (from 1-31)
ay():Returns the day of the week, according to universal time (from 0-6)
73. getUTCFullYear():Returns the year, according to universal time (four digits)
getUTCHours()Returns the hour, according to universal time (from 0-23)
getUTCMilliseconds(): Returns the milliseconds, according to universal time (from 0-999)
getUTCMinutes()Returns the minutes, according to universal time (from 0-59)
getUTCMonth()Returns the month, according to universal time (from 011)
getUTCSeconds()Returns the seconds, according to universal time (from 0-59)
setDate()Sets the day of the month (from 1-31)
<script type="text/javascript">
var d = new Date();
d.setDate(15);
document.write(d);
</script>
74. setFullYear()Sets the year (four digits)
<script type="text/javascript">
var d = new Date();
d.setFullYear(2020);
document.write(d);
</script>
Set the date to November 3, 1992
<script type="text/javascript">
var d=new Date();
d.setFullYear(1992,10,3);
document.write(d);
</script>
75. setHours()Sets the hour (from 0-23)
Date.setHours(hour,min,sec,millisec)
<script type="text/javascript">
var d = new Date();
d.setHours(15);
document.write(d);
</script>
Set the time to 15:35:01:
<script type="text/javascript">
var d = new Date();
d.setHours(15,35,1);
document.write(d);
</script>
76. setMilliseconds()Sets the milliseconds (from 0-999)
Set the milliseconds to 192:
<script type="text/javascript">
var d = new Date();
d.setMilliseconds(192);
document.write(d);
</script>
77. setMinutes()Set the minutes (from 0-59)
Date.setMinutes(min,sec,millisec)
Set the minutes to 01:
<script type="text/javascript">
var d = new Date();
d.setMinutes(1);
document.write(d);
</script>
Out Put:
Sun Aug 15 2010 19:01:08 GMT+0530 (India Standard Time)
78. setMonth()Sets the month (from 0-11)
Date.setMonth(month,day)
Set the month to 0 (January):
<script type="text/javascript">
var d = new Date();
d.setMonth(0);
document.write(d);
</script>
Set the month to 0 (January) and the day to 20:
<script type="text/javascript">
var d = new Date();
d.setMonth(0,20);
document.write(d);
</script>
79. setSeconds()Sets the seconds (from 0-59)
Date.setSeconds(sec,millisec)
Set the seconds to 01:
<script type="text/javascript">
var d = new Date();
d.setSeconds(1);
document.write(d);
</script>
80. setTime()Sets a date and time by adding or subtracting a specified number of
milliseconds to/from midnight January 1, 1970
Date.setTime(millisec)
<script type="text/javascript">
var d = new Date();
d.setTime(77771564221);
document.write(d);
</script>
81. setUTCDate()Sets the day of the month, according to universal time (from 1-31)
setUTCFullYear()Sets the year, according to universal time (four digits)
setUTCHours()Sets the hour, according to universal time (from 0-23)
setUTCMilliseconds()Sets the milliseconds, according to universal time (from 0-
999)
setUTCMinutes()Set the minutes, according to universal time (from 0-59)
setUTCMonth()Sets the month, according to universal time (from 0-11)
setUTCSeconds()Set the seconds, according to universal time (from 0-59)
82. Opening a New Window
To open a new window, you will need to use yet another ready-made JavaScript
function.
Here is what it looks like:
window.open('url to open','window name','attribute1,attribute2')
1.'url to open'
This is the web address of the page you wish to appear in the new window.
2. 'window name'
You can name your window whatever you like, in case you need to make a reference to
the window later.
3. 'attribute1,attribute2'
As with alot of other things, you have a choice of attributes you can adjust.
83. Window Attributes
Below is a list of the attributes you can use:
1. width=300
Use this to define the width of the new window.
2. height=200
Use this to define the height of the new window.
3. resizable=yes or no
Use this to control whether or not you want the user to be able to resize the
window.
4. scrollbars=yes or no
This lets you decide whether or not to have scrollbars on the window.
5. toolbar=yes or no
Whether or not the new window should have the browser navigation bar at the
top (The back, foward, stop buttons..etc.).
6. location=yes or no
Whether or not you wish to show the location box with the current url (The place
to type http://address).
84. 7. directories=yes or no
Whether or not the window should show the extra buttons. (what's cool,
personal buttons, etc...).
8. status=yes or no
Whether or not to show the window status bar at the bottom of the window.
9. menubar=yes or no
Whether or not to show the menus at the top of the window (File, Edit, etc...).
10. copyhistory=yes or no
Whether or not to copy the old browser window's history list to the new
window.