Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Intro To JS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kevin Kaminski
Intro To JS
Commits
38716a8a
Commit
38716a8a
authored
Apr 09, 2021
by
Kevin Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit:
parents
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
introToJs.html
introToJs.html
+114
-0
No files found.
introToJs.html
0 → 100644
View file @
38716a8a
<html>
<head>
<title>
Basic HTML !!!
</title>
<script
type=
"text/javascript"
>
var
color
=
"Orange"
;
function
myFunc
()
{
let
color2
=
"Blue"
;
document
.
write
(
color2
);
}
let
adder
=
(
int1
)
=>
{
let
total
=
int1
;
return
(
int2
)
=>
{
return
total
+
int2
;
}
}
</script>
</head>
<body>
<h1>
Hello, World!!
</h1>
Global Variables:
<script>
document
.
write
(
color
);
</script>
<br/>
Local Variable in Function:
<script>
myFunc
();
</script>
<br/>
Nested Functions:
<script>
let
numFunc
=
adder
(
10
);
document
.
write
(
`
${
numFunc
(
12
)}
`
)
</script>
<br/>
Switch:
<script>
let
num
=
0
switch
(
num
)
{
case
0
:
document
.
write
(
"0"
);
break
;
case
1
:
document
.
write
(
"1"
);
break
;
case
2
:
document
.
write
(
"2"
);
break
;
case
3
:
document
.
write
(
"3"
);
break
;
case
4
:
document
.
write
(
"4"
);
break
;
case
5
:
document
.
write
(
"5"
);
break
;
case
6
:
document
.
write
(
"6"
);
break
;
case
7
:
document
.
write
(
"7"
);
break
;
case
8
:
document
.
write
(
"8"
);
break
;
case
9
:
document
.
write
(
"9"
);
break
;
}
</script>
<br/>
Loops!
<script>
let
arr
=
[
"a"
,
"b"
,
"c"
,
"d"
,
"e"
]
document
.
write
(
"<br>"
)
document
.
write
(
"indices: "
)
for
(
let
i
in
arr
)
{
document
.
write
(
i
);
}
document
.
write
(
"<br>"
)
document
.
write
(
"values: "
)
for
(
let
i
of
arr
)
{
document
.
write
(
i
);
}
document
.
write
(
"<br>"
)
document
.
write
(
"values from while: "
)
let
i
=
0
;
while
(
i
<
arr
.
length
)
{
document
.
write
(
arr
[
i
]);
i
++
}
document
.
write
(
"<br>"
)
let
arr2
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
];
let
j
=
0
;
while
(
j
<
arr2
.
length
)
{
if
(
arr2
[
j
]
%
2
==
0
)
{
document
.
write
(
"even number"
);
document
.
write
(
"<br>"
)
}
else
{
document
.
write
(
"odd number"
);
document
.
write
(
"<br>"
)
}
j
++
}
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment