Skip to content

Commit 5367765

Browse files
authored
Add files via upload
add note
1 parent a445cb0 commit 5367765

5 files changed

+108
-0
lines changed

Arugments Object.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Arguments Object</title>
7+
</head>
8+
<body>
9+
<script>
10+
function sum(a,b)
11+
{
12+
document.write(arguments[1] +"<br>");
13+
document.write(arguments[0]+ "<br>");
14+
document.write(arguments.length); // count number of object/arguments
15+
}
16+
sum("Testing","codeing")
17+
</script>
18+
</body>
19+
</html>

Function Argument Missing .html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title> Function Arguments Missing</title>
7+
</head>
8+
<body>
9+
<script>
10+
//The missing values are set to undefined
11+
function sum(a,b,c){
12+
document.write("A:"+a+"B:"+b+"C:"+c);
13+
14+
}
15+
sum(30,20);
16+
</script>
17+
</body>
18+
</html>

Function with parameter.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Function with Parameter</title>
7+
</head>
8+
<body>
9+
<script>
10+
// 1. javscript function definitions do not specify data type for parameters.
11+
// 2. Javascript functions do not perform type checking on the passed arguments.
12+
// 3. Javascript function do note check the number of arguments received.
13+
function display(name){
14+
document.write(name);
15+
}
16+
display("ram");
17+
</script>
18+
19+
</body>
20+
</html>
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Creating and calling function </title>
7+
</head>
8+
<body>
9+
<!-- Creating function
10+
syntax: function function_name(){
11+
block of statement;
12+
}
13+
Rule
14+
1. Function name only starts with a letter , an underscore(-).
15+
2. function name cannot start with a number
16+
3. Do not use reserved keyword eg. else, if etc.
17+
4. Function names are case-sensitive in javascript.
18+
19+
20+
-->
21+
<!-- Ex creating -->
22+
<script>
23+
function name(){
24+
25+
document.write("hello");
26+
}
27+
// calling function
28+
name();
29+
</script>
30+
31+
</body>
32+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>To many Function argument</title>
7+
</head>
8+
<body>
9+
<script>
10+
function sum(a,b,c)
11+
{
12+
document.write("A :" + a+ "B:" +b);
13+
document.write("C:" + arguments[2]);
14+
}
15+
sum(10,20,50);
16+
</script>
17+
18+
</body>
19+
</html>

0 commit comments

Comments
 (0)