Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
javascript-fundamentals
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
Christopher Cottier
javascript-fundamentals
Commits
da3a8548
Commit
da3a8548
authored
Apr 09, 2021
by
ccottier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get your javascript fundamentals >>here<<
parents
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
0 deletions
+112
-0
index.html
index.html
+23
-0
myscript.js
myscript.js
+89
-0
No files found.
index.html
0 → 100644
View file @
da3a8548
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Document
</title>
<script
type=
"text/javascript"
src=
"myscript.js"
></script>
</head>
<body
id=
"bod"
>
<h1>
unstoppable html
</h1>
<script>
document
.
write
(
"<h2>Am i a real element?</h2>"
)
const
fun
=
function
(
personName
,
session
)
{
return
"Hello "
+
personName
+
"! Welcome to "
+
session
;
}(
'Pradeep'
,
'JavaScript'
);
document
.
write
(
fun
);
</script>
</body>
</html>
\ No newline at end of file
myscript.js
0 → 100644
View file @
da3a8548
//both html dom interactions and random JavaScript topics are in this file,
document
.
addEventListener
(
"DOMContentLoaded"
,
()
=>
{
const
body
=
document
.
getElementById
(
"bod"
);
const
div
=
document
.
createElement
(
"div"
);
div
.
innerText
=
"What time is it?"
;
body
.
appendChild
(
div
);
let
currentTime
;
const
timeDiv
=
document
.
createElement
(
"div"
);
body
.
appendChild
(
timeDiv
);
setInterval
(()
=>
{
currentTime
=
new
Date
();
const
hours
=
currentTime
.
getUTCHours
()
-
5
;
const
mins
=
currentTime
.
getUTCMinutes
();
const
seconds
=
currentTime
.
getUTCSeconds
();
timeDiv
.
innerText
=
`
${
hours
>
12
?
hours
-
12
:
hours
}
:
${
mins
<
10
?
`0
${
mins
}
`
:
mins
}
:
${
seconds
<
10
?
`0
${
seconds
}
`
:
seconds
}
CT`
;
},
1000
);
//Just JS stuff below
function
addingRecursion
(...
args
){
if
(
args
.
length
===
0
)
return
0
;
return
args
[
0
]
+
addingRecursion
(...
args
.
slice
(
1
));
}
console
.
log
(
addingRecursion
(
1
,
3
,
4
,
7
,
5
,
3
));
function
canHardly
(
num1
,
num2
){
return
num1
+
(
function
(){
return
num2
**
2
;})();
}
console
.
log
(
canHardly
(
1
,
8
));
function
imGonnaReturnMyself
(){
console
.
log
(
"completing complex algo for self returnation"
)
return
imGonnaReturnMyself
;
}
const
returned
=
imGonnaReturnMyself
();
const
counterFactory
=
()
=>
{
let
count
=
0
;
return
(
()
=>
{
count
++
;
console
.
log
(
count
);
}
)
}
const
counter1
=
counterFactory
();
counter1
();
counter1
();
if
(
2
==
"2"
){
let
arr
=
[
1785
,
2
%
5
,
34
,
2
==
"2"
];
for
(
let
el
of
arr
){
console
.
log
(
el
);
}
}
const
a
=
10
;
switch
(
a
)
{
case
10
:
console
.
log
(
"I'm 10"
);
break
;
case
21
:
console
.
log
(
"wow"
);
break
;
case
"10"
:
console
.
log
(
"string>"
);
break
;
}
})
\ 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