-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
982e898
commit bfacf39
Showing
2 changed files
with
329 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,324 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>JS Functions with Parameters</title> | ||
<style> | ||
* { | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
table { | ||
font-family: arial, sans-serif; | ||
border-collapse: collapse; | ||
width: 70%; | ||
} | ||
|
||
td, | ||
th { | ||
border: 1px solid #dddddd; | ||
text-align: left; | ||
padding: 8px; | ||
} | ||
|
||
tr:nth-child(even) { | ||
background-color: #dddddd; | ||
} | ||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: black; | ||
background: none; | ||
background-color: rgba(0, 0, 0, 0); | ||
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; | ||
font-size: 1em; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
word-wrap: normal; | ||
line-height: 1.5; | ||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
} | ||
|
||
:not(pre) > code[class*="language-"]::after, | ||
pre[class*="language-"]::after { | ||
right: 0.75em; | ||
|
||
left: auto; | ||
|
||
-webkit-transform: rotate(2deg); | ||
|
||
-moz-transform: rotate(2deg); | ||
|
||
-ms-transform: rotate(2deg); | ||
|
||
-o-transform: rotate(2deg); | ||
|
||
transform: rotate(2deg); | ||
} | ||
pre[class*="language-"]::before, | ||
pre[class*="language-"]::after { | ||
content: ""; | ||
|
||
z-index: -2; | ||
|
||
display: block; | ||
|
||
position: absolute; | ||
|
||
bottom: 0.75em; | ||
|
||
left: 0.18em; | ||
|
||
width: 40%; | ||
|
||
height: 20%; | ||
|
||
max-height: 13em; | ||
|
||
-webkit-transform: rotate(-2deg); | ||
|
||
-moz-transform: rotate(-2deg); | ||
|
||
-ms-transform: rotate(-2deg); | ||
|
||
-o-transform: rotate(-2deg); | ||
|
||
transform: rotate(-2deg); | ||
} | ||
|
||
:not(pre) > code[class*="language-"], | ||
pre[class*="language-"] { | ||
background-color: #fdfdfd; | ||
|
||
-webkit-box-sizing: border-box; | ||
|
||
-moz-box-sizing: border-box; | ||
|
||
box-sizing: border-box; | ||
|
||
margin-bottom: 1em; | ||
} | ||
pre[class*="language-"] { | ||
position: relative; | ||
|
||
margin: 0.5em 0; | ||
|
||
margin-bottom: 0.5em; | ||
|
||
overflow: visible; | ||
|
||
padding: 0; | ||
} | ||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: black; | ||
|
||
background: none; | ||
|
||
background-color: rgba(0, 0, 0, 0); | ||
|
||
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; | ||
|
||
font-size: 1em; | ||
|
||
text-align: left; | ||
|
||
white-space: pre; | ||
|
||
word-spacing: normal; | ||
|
||
word-break: normal; | ||
|
||
word-wrap: normal; | ||
|
||
line-height: 1.5; | ||
|
||
-moz-tab-size: 4; | ||
|
||
-o-tab-size: 4; | ||
|
||
tab-size: 4; | ||
|
||
-webkit-hyphens: none; | ||
|
||
-moz-hyphens: none; | ||
|
||
-ms-hyphens: none; | ||
|
||
hyphens: none; | ||
} | ||
pre { | ||
display: block; | ||
|
||
font-size: 87.5%; | ||
|
||
color: #212529; | ||
} | ||
pre { | ||
margin-top: 0; | ||
|
||
margin-bottom: 1rem; | ||
|
||
overflow: auto; | ||
|
||
-ms-overflow-style: scrollbar; | ||
} | ||
code, | ||
kbd, | ||
pre, | ||
samp { | ||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", | ||
"Courier New", monospace; | ||
|
||
font-size: 1em; | ||
} | ||
|
||
pre[class*="language-"] > code { | ||
position: relative; | ||
border-left: 10px solid #358ccb; | ||
box-shadow: -1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf; | ||
background-color: #fdfdfd; | ||
background-image: linear-gradient( | ||
transparent 50%, | ||
rgba(69, 142, 209, 0.04) 50% | ||
); | ||
background-size: 3em 3em; | ||
background-origin: content-box; | ||
background-attachment: local; | ||
} | ||
|
||
code[class*="language"] { | ||
max-height: inherit; | ||
height: inherit; | ||
padding: 0 1em; | ||
display: block; | ||
overflow: auto; | ||
} | ||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: black; | ||
background: none; | ||
background-color: rgba(0, 0, 0, 0); | ||
background-attachment: scroll; | ||
background-image: none; | ||
background-size: auto; | ||
background-origin: padding-box; | ||
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; | ||
font-size: 1em; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
word-wrap: normal; | ||
line-height: 1.5; | ||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
} | ||
|
||
pre code { | ||
font-size: inherit; | ||
color: inherit; | ||
word-break: normal; | ||
} | ||
|
||
code { | ||
font-size: 87.5%; | ||
color: #e83e8c; | ||
word-wrap: break-word; | ||
} | ||
code, | ||
kbd, | ||
pre, | ||
samp { | ||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", | ||
"Courier New", monospace; | ||
font-size: 1em; | ||
} | ||
*, | ||
::after, | ||
::before { | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>JS Functions with Parameters</h1> | ||
<p> | ||
The Javascript Function Parameters are the names that are defined in the | ||
function definition and real values passed to the function in the function | ||
definition are known as arguments. | ||
</p> | ||
<h1>Syntax:</h1> | ||
<pre | ||
class="language-javascript" | ||
tabindex="0" | ||
><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">Name</span><span class="token punctuation">(</span><span class="token parameter">paramet1<span class="token punctuation">,</span> paramet2<span class="token punctuation">,</span> paramet3<span class="token punctuation">,</span><span class="token operator">...</span></span><span class="token punctuation">)</span> | ||
<span class="token punctuation">{</span> | ||
<span class="token comment">// Statements</span> | ||
<span class="token punctuation">}</span></code></pre> | ||
<h1>Parameter Rules:</h1> | ||
<ul> | ||
<li> | ||
There is no need to specify the data type for parameters in JavaScript | ||
function definitions. | ||
</li> | ||
<li> | ||
It does not perform type-checking based on the passed-in JavaScript | ||
functions. | ||
</li> | ||
<li>It does not check the number of received arguments.</li> | ||
</ul> | ||
<h1>Parameters:</h1> | ||
<ul> | ||
<li>Name: It is used to specify the name of the function.</li> | ||
<li>Arguments: It is provided in the argument field of the function.</li> | ||
</ul> | ||
<h1>Default Parameter:</h1> | ||
<p> | ||
The default parameters are used to initialize the named parameters with | ||
default values in case, when no value or undefined is passed. | ||
</p> | ||
<h1>Syntax:</h1> | ||
<pre | ||
class="language-javascript" | ||
tabindex="0" | ||
><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">Name</span><span class="token punctuation">(</span><span class="token parameter">paramet1 <span class="token operator">=</span> value1<span class="token punctuation">,</span> paramet2 <span class="token operator">=</span> value2 <span class="token punctuation">.</span><span class="token punctuation">.</span> <span class="token punctuation">.</span></span><span class="token punctuation">)</span> | ||
<span class="token punctuation">{</span> | ||
<span class="token comment">// statements</span> | ||
<span class="token punctuation">}</span></code></pre> | ||
<pre | ||
class="language-markup" | ||
tabindex="0" | ||
><code class="language-markup"><span class="token doctype"><span class="token punctuation"><!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>html</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>head</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>title</span><span class="token punctuation">></span></span>JavaScript<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>title</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span><span class="token punctuation">></span></span><span class="token script"><span class="token language-javascript"> | ||
<span class="token comment">/* Functions With Parameters*/</span> | ||
<span class="token keyword">function</span> <span class="token function">hello</span><span class="token punctuation">(</span>fname<span class="token operator">=</span> <span class="token string">"Yahoo"</span><span class="token punctuation">,</span>lname<span class="token operator">=</span> <span class="token string">"Baba"</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> | ||
document<span class="token punctuation">.</span><span class="token function">write</span><span class="token punctuation">(</span><span class="token string">"Hello"</span> <span class="token operator">+</span> fname <span class="token operator">+</span> <span class="token string">" "</span> <span class="token operator">+</span> lname <span class="token operator">+</span> <span class="token string">"<br>"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> | ||
<span class="token punctuation">}</span> | ||
|
||
<span class="token function">hello</span><span class="token punctuation">(</span><span class="token string">"Ram"</span><span class="token punctuation">,</span><span class="token string">"Singh"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> | ||
<span class="token function">hello</span><span class="token punctuation">(</span><span class="token string">"Salman"</span><span class="token punctuation">,</span> <span class="token string">"Khan"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> | ||
</span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>head</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>body</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>body</span><span class="token punctuation">></span></span> | ||
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>html</span><span class="token punctuation">></span></span></code></pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters