Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
javascript-demo
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
Kyle Muldoon
javascript-demo
Commits
d4b10c51
Commit
d4b10c51
authored
Apr 09, 2021
by
Kyle Muldoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added loops and conditional branching
parent
009ccf6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
9 deletions
+50
-9
conceptsDemo.html
conceptsDemo.html
+50
-9
No files found.
conceptsDemo.html
View file @
d4b10c51
...
...
@@ -15,15 +15,6 @@
max-width
:
100%
;
min-width
:
100px
;
}
display
:
block
;
background
:
none
;
white-space
:
pre
;
-webkit-overflow-scrolling
:
touch
;
overflow-x
:
scroll
;
max-width
:
100
%;
min-width
:
100px
;
padding
:
0
;
</style>
</head>
<body>
...
...
@@ -137,6 +128,37 @@
<h4>
SWITCH
</h4>
<code>
let course = "art";
switch (course) {
case "art":
document.write("draw like picasso");
break;
case "math":
document.write("solve like newton");
break;
default:
document.write("do something else");
}
</code>
<script>
let
course
=
"art"
;
switch
(
course
)
{
case
"art"
:
document
.
write
(
"draw like picasso"
);
break
;
case
"math"
:
document
.
write
(
"solve like newton"
);
break
;
default
:
document
.
write
(
"do something else"
);
}
</script>
<hr>
</div>
...
...
@@ -144,6 +166,25 @@
<!-- ============================================================= -->
<div
class=
"concept"
id=
"loops"
>
<h2>
Loops
</h2>
<script>
numList
=
[
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
];
document
.
write
(
'<h3>for in loop</h3>'
);
for
(
let
i
in
numList
)
{
document
.
write
(
i
)};
document
.
write
(
'<h3>for of loop</h3>'
);
for
(
let
i
of
numList
)
{
document
.
write
(
i
)};
document
.
write
(
'<h3>while loop</h3>'
);
pets
=
[
'dog'
,
'cat'
,
'rabbit'
,
'bird'
,
'turtle'
];
let
i
=
0
;
while
(
pets
[
i
]
!==
'turtle'
)
{
console
.
log
(
'in while loop'
)
document
.
writeln
(
pets
[
i
]
+
'<br>'
);
i
++
;
}
</script>
<hr>
</div>
...
...
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