<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FC2%2FFunctions-in-JS%2FEnglish</id>
		<title>JavaScript/C2/Functions-in-JS/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FC2%2FFunctions-in-JS%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;action=history"/>
		<updated>2026-04-04T08:42:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=55278&amp;oldid=prev</id>
		<title>Nancyvarkey at 05:47, 21 June 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=55278&amp;oldid=prev"/>
				<updated>2021-06-21T05:47:02Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:47, 21 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Author: Jayesh Katta Ramalingaiah&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Author: Jayesh Katta Ramalingaiah&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Domain Reviewer: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Domain Reviewer: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Ankita Maske&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Novice Reviewer: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Novice Reviewer: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Praveeen S.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Keywords: JavaScript, HTML, Function, value, arguments, parameters&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Keywords: JavaScript, HTML, Function, value, arguments, parameters&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54773&amp;oldid=prev</id>
		<title>Pravin1389 at 05:51, 3 February 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54773&amp;oldid=prev"/>
				<updated>2021-02-03T05:51:46Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:51, 3 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 599:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 599:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''on JS'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''on JS'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Here, if we see the output '''Spoken Tutorials on JS '''is being '''logged''' from the '''d1, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'&lt;/del&gt;d2''' and '''d3 functions'''. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| Here, if we see the output '''Spoken Tutorials on JS '''is being '''logged''' from the '''d1, d2''' and '''d3 functions'''. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54728&amp;oldid=prev</id>
		<title>Nancyvarkey at 15:53, 17 January 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54728&amp;oldid=prev"/>
				<updated>2021-01-17T15:53:12Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;amp;diff=54728&amp;amp;oldid=54691&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54691&amp;oldid=prev</id>
		<title>Kr.jayesh: Created page with &quot;Title of the script:Functions  Author: Jayesh Katta Ramalingaiah  Domain Reviewer:   Novice Reviewer:   Keywords: JavaScript, HTML, Function, value, arguments, parameters    {...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=JavaScript/C2/Functions-in-JS/English&amp;diff=54691&amp;oldid=prev"/>
				<updated>2021-01-13T17:45:26Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Title of the script:Functions  Author: Jayesh Katta Ramalingaiah  Domain Reviewer:   Novice Reviewer:   Keywords: JavaScript, HTML, Function, value, arguments, parameters    {...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Title of the script:Functions&lt;br /&gt;
&lt;br /&gt;
Author: Jayesh Katta Ramalingaiah&lt;br /&gt;
&lt;br /&gt;
Domain Reviewer: &lt;br /&gt;
&lt;br /&gt;
Novice Reviewer: &lt;br /&gt;
&lt;br /&gt;
Keywords: JavaScript, HTML, Function, value, arguments, parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border = “1”&lt;br /&gt;
|| &amp;lt;center&amp;gt;'''Visual Cue'''&amp;lt;/center&amp;gt;&lt;br /&gt;
|| &amp;lt;center&amp;gt;'''Narration'''&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Title&lt;br /&gt;
|| Hello and Welcome to the spoken tutorial on “'''Functions in JS'''”.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: &lt;br /&gt;
&lt;br /&gt;
Learning Objectives&lt;br /&gt;
|| In this tutorial, we will learn about:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Functions'''&lt;br /&gt;
* Different '''types''' of '''functions''' and &lt;br /&gt;
* '''Function declarations''' in '''JS'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: System Specifications&lt;br /&gt;
|| This tutorial is recorded using:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Ubuntu Linux''' OS version 18.04&lt;br /&gt;
* '''Visual Studio Code''' version 1.51.1 ('''code editor''')&lt;br /&gt;
* '''Firefox''' web browser&lt;br /&gt;
&lt;br /&gt;
However you may use any other '''browser''' of your choice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide : Pre-requisites&lt;br /&gt;
|| To practice this tutorial,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You should be familiar with writing and executing''' JS''' files'''.'''&lt;br /&gt;
* If not, please go through the prerequisite tutorials on this website.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Code files&lt;br /&gt;
|| &lt;br /&gt;
* The files used in this tutorial are available in the''' Code files''' link on this tutorial page.&lt;br /&gt;
* Pls download and extract the file.&lt;br /&gt;
* Make a copy and then use them for practising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Functions&lt;br /&gt;
|| &lt;br /&gt;
* A '''function '''is a '''block''' of '''code''' which is defined once and can be called multiple times.&lt;br /&gt;
* The main advantage of a '''function''' is reusability.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Types of Functions&lt;br /&gt;
|| The different types of '''functions '''are,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Basic Function'''&lt;br /&gt;
* '''Parameterized Function'''&lt;br /&gt;
* '''Function as a value'''&lt;br /&gt;
* '''Function as a Argument/Parameter'''&lt;br /&gt;
* '''Function as Property'''&lt;br /&gt;
* '''Function Arguments'''&lt;br /&gt;
* '''Constructor Function'''&lt;br /&gt;
&lt;br /&gt;
Let us take an example and understand this better.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Welcome Page -&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open Folder -&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Practice-JS'''&lt;br /&gt;
|| In the '''Welcome page, '''click on the '''Open folder link '''at the top left corner'''.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Browse and locate the folder “'''Practice-JS''' ”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then click on the '''OK '''button at the top right corner.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Click on &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Explorer '''panel -&amp;gt; '''Practice-JS''' -&amp;gt; '''index.html'''&lt;br /&gt;
|| In the '''Explorer '''panel on the left, under '''Practice-JS''' click on the file named '''index.html'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;title&amp;gt;Functions&amp;lt;/title&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;script src=&amp;quot;main.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;/html&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|| In the '''index.html''' file, type the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this code we have written a small '''HTML''' code and linked the''' JS file'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Alt + L and Alt + O &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|| Now press the key combinations '''Alt + L''' and''' Alt + O.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''Live server''' gets started.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Show firefox&lt;br /&gt;
|| The default '''browser '''will open automatically and a new '''tab '''opens.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Firefox] Press&amp;lt;/nowiki&amp;gt;''' Ctrl + Shift + I'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Point to the '''Browser developer tools'''&lt;br /&gt;
|| Now press '''Ctrl + Shift + I''' keys together.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''Browser developer tools''' panel opens.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Firefox] Click on the &amp;lt;/nowiki&amp;gt;'''Console''' tab&lt;br /&gt;
|| Now click on the '''console tab''' in the '''developer tools.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Click on &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Explorer '''panel -&amp;gt; '''Practice-JS''' -&amp;gt; '''main.js'''&lt;br /&gt;
|| In the '''Explorer '''panel on the left, under '''Practice-JS''' click on the file named '''main.js'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function add() {&lt;br /&gt;
&lt;br /&gt;
console.log(1+2);&lt;br /&gt;
&lt;br /&gt;
return true;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
add();&lt;br /&gt;
&lt;br /&gt;
console.log(add());&lt;br /&gt;
|| In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function add()&lt;br /&gt;
|| In '''JS''', to create a basic '''function''', we use the '''function keyword'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is followed by the name of the '''function '''and '''brackets.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(1+2);&lt;br /&gt;
|| Inside the '''function block''', we can have multiple instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we just '''logged''' 1 + 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return true;&lt;br /&gt;
|| '''Functions '''always '''return '''some value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''return '''is an optional '''keyword'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you don’t use '''return keyword''' to return''' '''any value, by default '''undefined '''will be returned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, this '''function '''is returning '''true.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
add();&lt;br /&gt;
|| '''add()''' is a '''function''' '''call'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Only when the '''function '''is '''called''', will the '''function block '''get '''executed.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A '''function call''' can be made any number of times.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(add());&lt;br /&gt;
|| Here, I have written the '''add() function''' inside the '''console log statement'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So, whatever is being returned by the '''add() function''', will get '''logged'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3'''&lt;br /&gt;
&lt;br /&gt;
'''true'''&lt;br /&gt;
|| Here in the output, we observe:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''console''', at the right end of the 3, we see (2).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This means 3 is printed twice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
add();&lt;br /&gt;
|| The first '''3''' is printed for the first '''function call'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log('''add()''');&lt;br /&gt;
|| The second '''3''' is printed for the second '''function call'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''console.log('''add()''');'''&lt;br /&gt;
|| And '''true '''is printed because '''add()''' '''function’s return value''' is '''logged.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Type: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function sub(a) {&lt;br /&gt;
&lt;br /&gt;
return a - 1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result &amp;lt;nowiki&amp;gt;= sub(6);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
console.log(result);&lt;br /&gt;
|| Next, let us learn about '''parameterized function.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function sub(a) {&lt;br /&gt;
|| Here, we have created a '''function''' similar to the''' '''basic''' function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The only difference is we are passing a '''parameter a'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''parameter '''can be used for a purpose in the '''function'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return a - 1;&lt;br /&gt;
|| Here, we are subtracting the value and returning the subtracted value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result &amp;lt;nowiki&amp;gt;= sub(6);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|| In this line, the '''function call''' is made passing '''6''' as the '''parameter'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The returned value is stored in the '''result variable'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
console.log(result);&lt;br /&gt;
|| Here, we are '''logging''' the value on the '''console'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5'''&lt;br /&gt;
|| The output is '''5 '''because we have passed the number '''6''' as the '''parameter'''. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That value is being subtracted by 1 and returned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After returning, we are catching the value in a '''variable''' and '''logging''' it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var mul = function () {&lt;br /&gt;
&lt;br /&gt;
return true;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result = mul();&lt;br /&gt;
&lt;br /&gt;
console.log(result);&lt;br /&gt;
|| Next, let us learn about the '''function''' as a '''value'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var mul = function () &lt;br /&gt;
|| Here, we have declared a '''variable '''with the name '''mul.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The '''variable mul '''is assigned to a '''function '''using the '''function keyword'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We don’t have to give the name of the '''function '''again, followed by the '''function keyword'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The name of the''' function '''becomes''' mul''' here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function () &lt;br /&gt;
|| We call '''function ()''' as an '''anonymous function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we wish to, we can even pass some '''parameters '''to this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
return true;&lt;br /&gt;
|| This '''function '''just returns '''true'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result = mul();&lt;br /&gt;
|| The '''function call '''is similar to the basic''' '''and''' parameterized '''ones'''.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The returned value would be caught by the '''result variable.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(result);&lt;br /&gt;
|| Here, we are '''logging''' the '''result variable'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''true'''&lt;br /&gt;
|| Here, as the '''function''' returns '''true, True '''is printed on the '''console'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function d1() {&lt;br /&gt;
&lt;br /&gt;
console.log('Spoken');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function d2() {&lt;br /&gt;
&lt;br /&gt;
console.log('Tutorials');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function d3() {&lt;br /&gt;
&lt;br /&gt;
console.log('on JS');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function display(fn, fn1, fn2) {&lt;br /&gt;
&lt;br /&gt;
fn();&lt;br /&gt;
&lt;br /&gt;
fn1();&lt;br /&gt;
&lt;br /&gt;
fn2();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display(d1, d2, d3);&lt;br /&gt;
|| Next, let us learn about '''function '''as a '''parameter'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function d1() {&lt;br /&gt;
&lt;br /&gt;
console.log('Spoken');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function d2() {&lt;br /&gt;
&lt;br /&gt;
console.log('Tutorials');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function d3() {&lt;br /&gt;
&lt;br /&gt;
console.log('on JS');&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|| Here, we have declared three '''functions '''with names''' d1, d2 and d3''' respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function display(fn, fn1, fn2)&lt;br /&gt;
|| Here, I have created another '''function '''named '''display.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To this, we are passing 3 '''parameters '''named '''fn, fn1 '''and''' fn2.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
fn();&lt;br /&gt;
&lt;br /&gt;
fn1();&lt;br /&gt;
&lt;br /&gt;
fn2();&lt;br /&gt;
|| Inside, the '''display function''',we’re making '''function''' '''calls''' for the '''parameters'''. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is because the '''parameters''' are '''functions'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display(d1, d2, d3);&lt;br /&gt;
|| While making the '''display function call, '''we’re passing 3 '''functions d1, d2 '''and '''d3''' respectively.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, as we’re passing '''d1,d2 '''and '''d3''', these '''functions''' would be called '''callback functions.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: '''callback function'''&lt;br /&gt;
|| '''Callback function''' is defined as a '''function''' which is '''passed''' as a '''parameter '''to another '''function.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
display(d1, d2, d3);&lt;br /&gt;
|| '''d1, d2 '''and''' d3 '''will be taken as '''fn, fn1, fn2''' in '''display function '''as the '''parameters.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On making the '''function call''' for '''fn,fn1''' and''' fn2, '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''d1,d2 '''and''' d3 functions '''will be executed.''' '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Spoken'''&lt;br /&gt;
&lt;br /&gt;
'''Tutorials'''&lt;br /&gt;
&lt;br /&gt;
'''on JS'''&lt;br /&gt;
|| Here, if we see the output '''Spoken Tutorials on JS '''is being logged from the '''d1''', '''d2''' and '''d3''' '''functions'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var student = {&lt;br /&gt;
&lt;br /&gt;
marks: function () {&lt;br /&gt;
&lt;br /&gt;
return 100;&lt;br /&gt;
&lt;br /&gt;
},&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result = student.marks();&lt;br /&gt;
&lt;br /&gt;
console.log(result);&lt;br /&gt;
|| Next, let us learn about '''function '''as a '''property.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] &amp;lt;/nowiki&amp;gt;Highlight:&lt;br /&gt;
&lt;br /&gt;
var student = {};&lt;br /&gt;
|| Here, '''student '''is the '''object'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
marks: function () {&lt;br /&gt;
&lt;br /&gt;
return 100;&lt;br /&gt;
&lt;br /&gt;
},&lt;br /&gt;
|| Here, '''marks '''is a '''property''' in the '''student''' '''object''', which holds an '''anonymous function.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return 100;&lt;br /&gt;
|| This '''function''' returns 100.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var result = student.marks();&lt;br /&gt;
|| To make a '''function call''', we need to call the '''property '''inside the '''student object'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we access the marks as '''student.marks'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To make a '''function''' '''call''' we add '''brackets '''similar to a '''function''' as a''' value.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we have named the '''function '''as '''marks.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The returned value is stored in '''variable result. '''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| console.log(result);&lt;br /&gt;
|| Here, we are '''logging '''the '''result.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''100'''&lt;br /&gt;
|| Here, the output is 100 as the '''function returns''' 100&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function marks() {&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;for (var i = 0; i &amp;lt; arguments.length; i++) {&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;console.log(arguments[i]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
marks(87, 78, 90, 81);&lt;br /&gt;
|| Next, let us understand about '''function arguments.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
marks(87, 78, 90, 81);&lt;br /&gt;
|| So far, when we passed '''parameters '''to a '''function''', we declared a '''parameter variable '''while creating the '''function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example helps us in a situation where we are not sure of the number of '''parameters''' to be '''passed'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this case, we are '''passing''' 4 '''parameters'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function marks() {}&lt;br /&gt;
|| And, we have not '''declared''' any '''variables '''to '''catch''' the values '''passed''' in the '''marks function'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;for (var i = 0; i &amp;lt; arguments.length; i++) {&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|| Using the '''keyword arguments, '''we can access the '''parameters '''being '''passed'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''arguments.length, '''will give the number of the '''arguments''' being '''passed'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we can '''loop''' over and get the values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note here that the '''prototype '''of the '''arguments''' is '''array '''but the '''data structure''' is '''object.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;console.log(arguments[i]);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|| Here, we are just '''logging''' the value in the '''arguments.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
'''87'''&lt;br /&gt;
&lt;br /&gt;
'''78'''&lt;br /&gt;
&lt;br /&gt;
'''90'''&lt;br /&gt;
&lt;br /&gt;
'''81'''&lt;br /&gt;
|| As we are '''passing''' '''87, 78, 90, 81''' as '''parameters, '''the output we get is '''87, 78, 90, 81.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to Editor&lt;br /&gt;
|| Switch back to the '''editor.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Type: &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function Student(stuName, stuAge) {&lt;br /&gt;
&lt;br /&gt;
this.name = stuName;&lt;br /&gt;
&lt;br /&gt;
this.age = stuAge;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var s1 = new Student(&amp;quot;S1&amp;quot;, 10);&lt;br /&gt;
&lt;br /&gt;
var s2 = new Student(&amp;quot;S2&amp;quot;, 11);&lt;br /&gt;
&lt;br /&gt;
console.log(s1);&lt;br /&gt;
&lt;br /&gt;
console.log(s2);&lt;br /&gt;
|| Next, let us understand the '''constructor''' '''function'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the '''main.js '''file, replace the '''code''' as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function Student(stuName, stuAge) &lt;br /&gt;
|| Here, we have created a '''function '''named '''Student '''and '''passing''' the '''parameters stuName '''and '''stuAge.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Only in the '''constructor function''', the name of the '''function '''starts with an '''uppercase '''letter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this.name = stuName;&lt;br /&gt;
&lt;br /&gt;
this.age = stuAge;&lt;br /&gt;
|| Inside the '''function block''' we have assigned, '''this.name''' as '''stuName '''and '''this.age''' as '''stuAge'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, '''this '''refers to the '''variable '''name, where the '''function call '''is made.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var s1 = new Student(&amp;quot;S1&amp;quot;, 10);&lt;br /&gt;
&lt;br /&gt;
var s2 = new Student(&amp;quot;S2&amp;quot;, 11);&lt;br /&gt;
|| Here, we have made the''' function calls''',&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the '''constructor function, new keyword''' has to be used while making the '''function call'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the first''' function call''', the '''variable name '''is '''s1,''' so this refers to''' s1.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the second''' function call''', the '''variable name '''is '''s2,''' so this refers to''' s2.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only narration&lt;br /&gt;
|| The '''constructor function''' creates a '''new object''' with help of '''parameters '''and '''returns '''the '''object.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The returned '''object '''will be stored in the respective '''variable'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Editor] Highlight:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
console.log(s1);&lt;br /&gt;
&lt;br /&gt;
console.log(s2);&lt;br /&gt;
|| Here, we are '''logging s1 '''and '''s2'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Press: Ctrl + S&lt;br /&gt;
|| Save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Switch to '''Browser'''&lt;br /&gt;
|| Switch back to the '''browser.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;lt;nowiki&amp;gt;[Browser] [Console Tab]:&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Highlight:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object { name: &amp;quot;S1&amp;quot;, age: 10 }'''&lt;br /&gt;
&lt;br /&gt;
'''Object { name: &amp;quot;S2&amp;quot;, age: 11 }'''&lt;br /&gt;
|| Here, we see we have 2 '''objects '''printed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One for '''s1''' and other for '''s2, '''with the '''property '''names as '''name '''and '''age '''as mentioned in '''function block.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And the values are '''stuName '''and '''stuAge '''which are '''passed''' as '''parameters'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Only narration&lt;br /&gt;
|| Hence, we conclude that the '''constructor function''' returns an '''object.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While making a '''function call, new keyword''' would be responsible for creating the '''new object.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
|| With this we have come to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let’s summarize.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide''': '''Summary''' '''&lt;br /&gt;
|| In this tutorial, we have learnt about:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Functions'''&lt;br /&gt;
* Different types of '''functions''' and &lt;br /&gt;
* '''Function declarations''' in '''JS'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Assignment&lt;br /&gt;
|| As an assignment:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Open the file '''assignment.js''' which you have created earlier&lt;br /&gt;
* Clear the existing code&lt;br /&gt;
* Create an '''Employee function'''&lt;br /&gt;
* '''Employee function '''accepts '''name '''and '''id '''as '''parameters'''&lt;br /&gt;
* Create '''Object '''references to '''name '''and '''id parameter'''&lt;br /&gt;
* Create two''' objects '''using the '''Employee '''function&lt;br /&gt;
* '''Log''' the created '''objects''' in the '''console'''&lt;br /&gt;
* Open the file '''MyPage.html '''in a '''web''' '''browser'''.&lt;br /&gt;
* Observe the output in the '''browser’s console'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide: '''About Spoken Tutorial Project&lt;br /&gt;
|| &lt;br /&gt;
* The video at the following link summarises the Spoken Tutorial project.&lt;br /&gt;
* Please download and watch it&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide:''' Spoken tutorial workshops&lt;br /&gt;
|| &lt;br /&gt;
* We conduct workshops using spoken tutorials and give certificates.&lt;br /&gt;
* For more details, please write to us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Forum questions&lt;br /&gt;
|| Pls post your timed queries in this forum&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Acknowledgement&lt;br /&gt;
|| Spoken Tutorial Project is funded by Ministry of Education (MoE), Government of India&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide: Thanks&lt;br /&gt;
|| The script for this tutorial is contributed by Jayesh.&lt;br /&gt;
&lt;br /&gt;
And this is Praveen from IIT Bombay signing off. &lt;br /&gt;
&lt;br /&gt;
Thank you for joining.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Kr.jayesh</name></author>	</entry>

	</feed>