Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
javascript-fundamentals
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Cottier
javascript-fundamentals
Commits
da3a8548
There was an error fetching the commit references. Please try again later.
Commit
da3a8548
authored
4 years ago
by
ccottier
Browse files
Options
Downloads
Patches
Plain Diff
get your javascript fundamentals >>here<<
parents
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.html
+23
-0
23 additions, 0 deletions
index.html
myscript.js
+89
-0
89 additions, 0 deletions
myscript.js
with
112 additions
and
0 deletions
index.html
0 → 100644
+
23
−
0
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
This diff is collapsed.
Click to expand it.
myscript.js
0 → 100644
+
89
−
0
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
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment