├── .replit
├── .vscode
└── settings.json
├── Asynchronous Programming
├── index.html
├── script.js
└── style.css
├── DOM Manipulation
├── Capture.PNG
├── index.html
├── script.js
└── style.css
├── README.md
├── api
├── exercise
│ ├── Random Dog
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ └── Super Hero API
│ │ ├── images
│ │ ├── 360_F_303367473_rTRc0Cux44BK2qyMLZhLzyzLT0t9J8Y0.jpg
│ │ └── istockphoto-1146894154-612x612.jpg
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
└── solution
│ ├── dogRandom
│ ├── index.html
│ └── script.js
│ └── superHero
│ ├── index.html
│ └── script.js
├── classes
├── banksClass
│ ├── index.html
│ └── script.js
└── carClass
│ └── script.js
├── dom
└── red-yellow-green
│ ├── index.html
│ └── script.js
├── exercises
├── arraysorting.js
├── converthourstoseconds.js
├── daysinamonth.js
├── findMax.js
├── index.html
├── palindromechecker.js
└── savingsstrategy.js
├── functions
└── sum
│ ├── exercise
│ ├── index.html
│ └── script.js
│ └── solution
│ ├── index.html
│ └── script.js
├── index.html
├── notes
├── arrays.js
├── baby-capstone.js
├── conditions.js
├── console-log.js
├── functions.js
├── mini-weather-app.js
├── objects.js
├── promise-examples.js
├── promises-async-await-apis.js
├── redBlueGreenSquares.js
├── tip-calculator.js
└── variables.js
├── playground.js
├── projects
├── fetchmovies
│ └── solution
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
├── fightingGame
│ ├── exercise
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ └── solution
│ │ ├── index.html
│ │ ├── solution.js
│ │ ├── sounds
│ │ ├── fastheal.mp3
│ │ ├── fastpunch.mp3
│ │ ├── quickheal.mp3
│ │ └── quickhit.mp3
│ │ └── style.css
├── rockpaperscissors
│ ├── exercise
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ └── solution
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
├── stopwatch
│ ├── exercise
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ └── solution
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
├── tip-calculator
│ ├── exercise
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ └── solution
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
└── weather-app
│ ├── exercise
│ ├── index.html
│ ├── script.js
│ └── style.css
│ └── solution
│ ├── index.html
│ ├── script.js
│ └── style.css
├── replit.nix
├── style.css
└── yourPlayground.js
/.replit:
--------------------------------------------------------------------------------
1 | hidden=[".config"]
2 |
3 | # hosting is currently hardcoded for this language
4 | # [hosting]
5 | # route = "/"
6 | # directory= "/"
7 |
8 | [nix]
9 | channel = "stable-21_11"
10 |
11 | [languages.html]
12 | pattern = "**/*.html"
13 | [languages.html.languageServer]
14 | start = ["vscode-html-language-server", "--stdio"]
15 | [languages.html.languageServer.initializationOptions]
16 | provideFormatter = true
17 | [languages.html.languageServer.configuration.html]
18 | customData = [ ]
19 | autoCreateQuotes = true
20 | autoClosingTags = true
21 | mirrorCursorOnMatchingTag = false
22 |
23 | [languages.html.languageServer.configuration.html.completion]
24 | attributeDefaultValue = "doublequotes"
25 |
26 | [languages.html.languageServer.configuration.html.format]
27 | enable = true
28 | wrapLineLength = 120
29 | unformatted = "wbr"
30 | contentUnformatted = "pre,code,textarea"
31 | indentInnerHtml = false
32 | preserveNewLines = true
33 | indentHandlebars = false
34 | endWithNewline = false
35 | extraLiners = "head, body, /html"
36 | wrapAttributes = "auto"
37 | templating = false
38 | unformattedContentDelimiter = ""
39 |
40 | [languages.html.languageServer.configuration.html.suggest]
41 | html5 = true
42 |
43 | [languages.html.languageServer.configuration.html.validate]
44 | scripts = true
45 | styles = true
46 |
47 | [languages.html.languageServer.configuration.html.hover]
48 | documentation = true
49 | references = true
50 |
51 | [languages.html.languageServer.configuration.html.trace]
52 | server = "off"
53 |
54 | [languages.javascript]
55 | pattern = "**/{*.js,*.jsx,*.ts,*.tsx,*.mjs,*.cjs}"
56 | [languages.javascript.languageServer]
57 | start = ["typescript-language-server", "--stdio"]
58 |
59 | # TODO autocomplete relies on snippet support, which we don't advertise to LSP servers.
60 | # For now CSS autocomplete will use built-in codemirror, which is not perfect but good enough
61 | [languages.css]
62 | pattern = "**/{*.less,*.scss,*.css}"
63 | [languages.css.languageServer]
64 | start = ["vscode-css-language-server", "--stdio"]
65 | [languages.css.languageServer.configuration.css]
66 | customData = [ ]
67 | validate = true
68 |
69 | [languages.css.languageServer.configuration.css.completion]
70 | triggerPropertyValueCompletion = true
71 | completePropertyWithSemicolon = true
72 |
73 | [languages.css.languageServer.configuration.css.hover]
74 | documentation = true
75 | references = true
76 |
77 | [languages.css.languageServer.configuration.css.lint]
78 | # Configure linting
79 | # ignore = don't show any warning or error
80 | # warning = show yellow underline
81 | # error = show red underline
82 | argumentsInColorFunction = "error" # Invalid number of parameters
83 | boxModel = "ignore" # Do not use width or height when using padding or border
84 | compatibleVendorPrefixes = "ignore" # When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
85 | duplicateProperties = "warning" # Do not use duplicate style definitions
86 | emptyRules = "warning" # Do not use empty rulesets
87 | float = "ignore" # Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.
88 | fontFaceProperties = "warning" # @font-face rule must define 'src' and 'font-family' properties
89 | hexColorLength = "error" # Hex colors must consist of three, four, six or eight hex numbers
90 | idSelector = "ignore" # Selectors should not contain IDs because these rules are too tightly coupled with the HTML.
91 | ieHack = "ignore" # IE hacks are only necessary when supporting IE7 and older
92 | important = "ignore" # Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.
93 | importStatement = "ignore" # Import statements do not load in parallel
94 | propertyIgnoredDueToDisplay = "warning" # Property is ignored due to the display
95 | universalSelector = "ignore" # The universal selector (*) is known to be slow
96 | unknownAtRules = "warning" # Unknown at-rule
97 | unknownProperties = "warning" # Unknown property.
98 | validProperties = [ ] # add some properties that the linter doesn't know about
99 | unknownVendorSpecificProperties = "ignore" # Unknown vendor specific property.
100 | vendorPrefix = "warning" # When using a vendor-specific prefix also include the standard property
101 | zeroUnits = "ignore" # No unit for zero needed
102 |
103 | [languages.css.languageServer.configuration.css.trace]
104 | server = "off"
105 |
106 | [languages.css.languageServer.configuration.scss]
107 | validate = true
108 |
109 | [languages.css.languageServer.configuration.scss.completion]
110 | triggerPropertyValueCompletion = true
111 | completePropertyWithSemicolon = true
112 |
113 | [languages.css.languageServer.configuration.scss.hover]
114 | documentation = true
115 | references = true
116 |
117 | [languages.css.languageServer.configuration.scss.lint]
118 | # Configure linting
119 | # ignore = don't show any warning or error
120 | # warning = show yellow underline
121 | # error = show red underline
122 | argumentsInColorFunction = "error" # Invalid number of parameters
123 | boxModel = "ignore" # Do not use width or height when using padding or border
124 | compatibleVendorPrefixes = "ignore" # When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
125 | duplicateProperties = "warning" # Do not use duplicate style definitions
126 | emptyRules = "warning" # Do not use empty rulesets
127 | float = "ignore" # Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.
128 | fontFaceProperties = "warning" # @font-face rule must define 'src' and 'font-family' properties
129 | hexColorLength = "error" # Hex colors must consist of three, four, six or eight hex numbers
130 | idSelector = "ignore" # Selectors should not contain IDs because these rules are too tightly coupled with the HTML.
131 | ieHack = "ignore" # IE hacks are only necessary when supporting IE7 and older
132 | important = "ignore" # Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.
133 | importStatement = "ignore" # Import statements do not load in parallel
134 | propertyIgnoredDueToDisplay = "warning" # Property is ignored due to the display
135 | universalSelector = "ignore" # The universal selector (*) is known to be slow
136 | unknownAtRules = "warning" # Unknown at-rule
137 | unknownProperties = "warning" # Unknown property.
138 | validProperties = [ ] # add some properties that the linter doesn't know about
139 | unknownVendorSpecificProperties = "ignore" # Unknown vendor specific property.
140 | vendorPrefix = "warning" # When using a vendor-specific prefix also include the standard property
141 | zeroUnits = "ignore" # No unit for zero needed"
142 |
143 | [languages.css.languageServer.configuration.less]
144 | validate = true
145 |
146 | [languages.css.languageServer.configuration.less.completion]
147 | triggerPropertyValueCompletion = true
148 | completePropertyWithSemicolon = true
149 |
150 | [languages.css.languageServer.configuration.less.hover]
151 | documentation = true
152 | references = true
153 |
154 | [languages.css.languageServer.configuration.less.lint]
155 | # Configure linting
156 | # ignore = don't show any warning or error
157 | # warning = show yellow underline
158 | # error = show red underline
159 | argumentsInColorFunction = "error" # Invalid number of parameters
160 | boxModel = "ignore" # Do not use width or height when using padding or border
161 | compatibleVendorPrefixes = "ignore" # When using a vendor-specific prefix make sure to also include all other vendor-specific properties"
162 | duplicateProperties = "warning" # Do not use duplicate style definitions
163 | emptyRules = "warning" # Do not use empty rulesets
164 | float = "ignore" # Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.
165 | fontFaceProperties = "warning" # @font-face rule must define 'src' and 'font-family' properties
166 | hexColorLength = "error" # Hex colors must consist of three, four, six or eight hex numbers
167 | idSelector = "ignore" # Selectors should not contain IDs because these rules are too tightly coupled with the HTML.
168 | ieHack = "ignore" # IE hacks are only necessary when supporting IE7 and older
169 | important = "ignore" # Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.
170 | importStatement = "ignore" # Import statements do not load in parallel
171 | propertyIgnoredDueToDisplay = "warning" # Property is ignored due to the display
172 | universalSelector = "ignore" # The universal selector (*) is known to be slow
173 | unknownAtRules = "warning" # Unknown at-rule
174 | unknownProperties = "warning" # Unknown property.
175 | validProperties = [ ] # add some properties that the linter doesn't know about
176 | unknownVendorSpecificProperties = "ignore" # Unknown vendor specific property.
177 | vendorPrefix = "warning" # When using a vendor-specific prefix also include the standard property
178 | zeroUnits = "ignore" # No unit for zero needed"
179 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "liveServer.settings.port": 5501
3 | }
--------------------------------------------------------------------------------
/Asynchronous Programming/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Aysnchronous Programming
8 |
9 |
10 |
11 |
12 |
Getting started with Asynchronous Programming
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Asynchronous Programming/script.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AyushSoni86/JavaScript-Course-by-Clever-Programmer-/58c991495a98fd958ca6b2ea124645dd368f91bc/Asynchronous Programming/script.js
--------------------------------------------------------------------------------
/Asynchronous Programming/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: coral;
3 | color: rgb(124, 64, 20);
4 | font-family: cursive;
5 | }
6 |
7 | .container {
8 | display: flex;
9 | height: 300px;
10 | width: auto;
11 | justify-content: center;
12 | align-items: center;
13 | }
14 |
--------------------------------------------------------------------------------
/DOM Manipulation/Capture.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AyushSoni86/JavaScript-Course-by-Clever-Programmer-/58c991495a98fd958ca6b2ea124645dd368f91bc/DOM Manipulation/Capture.PNG
--------------------------------------------------------------------------------
/DOM Manipulation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
DOM manipulation
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/DOM Manipulation/script.js:
--------------------------------------------------------------------------------
1 | // console.log('Hello')
2 |
3 | // let title = document.getElementById('title');
4 |
5 | // console.log(title.innerText);
6 |
7 | // let message = "Nikal Bhosdike"
8 |
9 |
10 | // title.innerText = message
11 | // console.log(title.innerText);
12 |
13 | // title.innerHTML = `${message}
`;
14 |
15 | // title.style.color = 'red'
16 |
17 | // let redDiv = document.getElementById('red');
18 | // let greenDiv = document.getElementById('green');
19 | // let blue = document.getElementById('blue');
20 |
21 | // redDiv.onclick = () => console.log('red')
22 | // greenDiv.onclick = () => console.log('green')
23 | // blue.onclick = () => console.log('blue')
24 |
25 | let squares = document.querySelectorAll('.colorSquare')
26 | // console.log(squares)
27 |
28 | // console.log(squares[0].value)
29 | // console.log(squares[1].value)
30 | // console.log(squares[2].value)
31 |
32 | // using a foreach loop
33 | const timesClicked = { 'red': 0, 'blue': 0, 'green': 0 }
34 |
35 | squares.forEach(squares => {
36 | squares.onclick = () => {
37 | timesClicked[squares.value] += 1;
38 | squares.innerText = timesClicked[squares.value];
39 | }
40 | })
41 |
42 | function clearScore() {
43 | timesClicked.red = 0;
44 | timesClicked.green = 0;
45 | timesClicked.blue = 0;
46 | squares.forEach(squares => {
47 | squares.innerText = "";
48 | });
49 | }
50 | const clearGame = document.getElementById('clear-score');
51 | // clearGame.onclick = () => clearScore()
52 |
53 | const randomSelectFromArray = (fruits) => {
54 | const randomNumber = Math.floor(Math.random() * fruits.length);
55 | return fruits[randomNumber];
56 | }
57 |
58 |
59 | let fruits = ['banana', 'apple', 'orange', 'guava']
60 | // console.log(randomSelectFromArray(fruits));
61 |
62 | const weatherScore =(wheather) =>{
63 | let score;
64 | if (wheather == 'rainy') {
65 | score = 1;
66 | }else if (wheather == 'sunny') {
67 | score = -1;
68 | } else {
69 | score = 0;
70 | }
71 | return score;
72 | }
--------------------------------------------------------------------------------
/DOM Manipulation/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | display: flex;
3 | justify-content: center;
4 | gap: 50px;
5 | }
6 |
7 | #red,
8 | #blue,
9 | #green {
10 | width: 100px;
11 | height: 100px;
12 | }
13 |
14 | #red {
15 | background-color: red;
16 | }
17 | #blue {
18 | background-color: blue;
19 | }
20 | #green {
21 | background-color: green;
22 | }
23 | #clear-score{
24 | margin-top: 20px;
25 | }
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JavaScript-Course-by-Clever-Programmer-
2 | This is a full JavaScript course by Clever Programmer
3 |
--------------------------------------------------------------------------------
/api/exercise/Random Dog/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | API's
8 |
9 |
10 |
11 |
12 |
13 |
API calls in Javascript
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/api/exercise/Random Dog/script.js:
--------------------------------------------------------------------------------
1 | // https://dog.ceo/api/breeds/image/random
2 |
3 | const dogImageDiv = document.getElementById('dogImage');
4 | const dogBtn = document.getElementById('dogButton')
5 |
6 | // stuff you have to wait for
7 | // asynchronous programming
8 | // .then - promises
9 | const getDog = () => {
10 | fetch('https://dog.ceo/api/breeds/image/random')
11 | .then(response => response.json())
12 | .then(json => {
13 | // console.log(json.message);
14 | dogImageDiv.innerHTML =
15 | `
`
16 | });
17 | }
18 |
19 |
20 | dogBtn.onclick = () => getDog();
--------------------------------------------------------------------------------
/api/exercise/Random Dog/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 |
7 | body {
8 | background-image: linear-gradient(
9 | to right,
10 | rgb(80, 80, 209),
11 | rgb(80, 179, 80)
12 | );
13 | }
14 |
15 | .apiCall {
16 | color: white;
17 | font-size: 50px;
18 | font-family: cursive;
19 | }
20 |
21 | .container {
22 | display: flex;
23 | flex-direction: column;
24 | gap: 30px;
25 | margin-top: 100px;
26 | }
27 |
28 | #dogButton {
29 | margin: 10px 60px;
30 | padding: 20px;
31 | border: none;
32 | background-color: rgba(63, 207, 135, 0.925);
33 | border-radius: 13px;
34 | box-shadow: 4px 3px 11px 0px;
35 | size: 10px;
36 | font-size: 32px;
37 | font-weight: bold;
38 | }
39 |
40 | img {
41 | max-width: 80%;
42 | height: auto;
43 | border-radius: 10px;
44 | box-shadow: 4px 3px 11px 0px;
45 | transition: transform 0.2s;
46 | }
47 |
48 | img:hover {
49 | transform: scale(1.08);
50 | box-shadow: 6px 3px 11px 0px;
51 | }
52 |
53 | #dogImage {
54 | justify-content: center;
55 | align-items: center;
56 | }
57 |
58 | button:cli{
59 |
60 | }
61 |
62 | button:hover{
63 | transform: scale(1.03);
64 | }
--------------------------------------------------------------------------------
/api/exercise/Super Hero API/images/360_F_303367473_rTRc0Cux44BK2qyMLZhLzyzLT0t9J8Y0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AyushSoni86/JavaScript-Course-by-Clever-Programmer-/58c991495a98fd958ca6b2ea124645dd368f91bc/api/exercise/Super Hero API/images/360_F_303367473_rTRc0Cux44BK2qyMLZhLzyzLT0t9J8Y0.jpg
--------------------------------------------------------------------------------
/api/exercise/Super Hero API/images/istockphoto-1146894154-612x612.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AyushSoni86/JavaScript-Course-by-Clever-Programmer-/58c991495a98fd958ca6b2ea124645dd368f91bc/api/exercise/Super Hero API/images/istockphoto-1146894154-612x612.jpg
--------------------------------------------------------------------------------
/api/exercise/Super Hero API/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Random SuperHero
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/api/exercise/Super Hero API/script.js:
--------------------------------------------------------------------------------
1 | // 837972860711403 my token
2 | // https://superheroapi.com/api/access-token/character-id/
3 |
4 | const SUPERHERO_TOKEN = '837972860711403';
5 | const BASE_URL = `https://www.superheroapi.com/api.php/${SUPERHERO_TOKEN}`;
6 |
7 | const heroImageDiv = document.getElementById('heroImage');
8 |
9 | const searchButton = document.getElementById('searchBtn');
10 |
11 | const searchInput = document.getElementById('heroName');
12 |
13 | const statToEmoji = {
14 | intelligence: '🧠',
15 | strength: '💪',
16 | speed: '⚡',
17 | durability: '🏋️♂️',
18 | power: '📊',
19 | combat: '⚔️',
20 | }
21 |
22 | const showHeroInfo = (character) => {
23 | const name = `${character.name}
`
24 |
25 | const img = `
`
26 |
27 | const stats = Object.keys(character.powerstats).map(stat => {
28 | return `${statToEmoji[stat]} ${stat}: ${character.powerstats[stat]}
`
29 | }).join('')
30 |
31 | heroImageDiv.innerHTML =
32 | `
33 |
${img}
34 |
${name}
${stats.toUpperCase()}
35 |
`
36 | }
37 |
38 | const getRandomSuperHero = (id) => {
39 | fetch(`${BASE_URL}/${id}`)
40 | .then(response => response.json())
41 | .then(json => {
42 | const hero = json
43 | showHeroInfo(hero);
44 | })
45 | }
46 |
47 | const getSearchSuperHero = (name) => {
48 | fetch(`${BASE_URL}/search/${name}`)
49 | .then(response => response.json())
50 | .then(json => {
51 | const hero = json.results[0];
52 | console.log(hero);
53 | showHeroInfo(hero);
54 | })
55 | }
56 |
57 |
58 | const getRandom = () => Math.ceil(Math.random() * 731);
59 |
60 | getHero.onclick = () => getRandomSuperHero(getRandom());
61 |
62 | searchButton.onclick = () => getSearchSuperHero(searchInput.value);
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/api/exercise/Super Hero API/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | padding: 0;
3 | margin: 0;
4 | box-sizing: border-box;
5 | font-family: cursive;
6 | font-size: 20px;
7 | }
8 | body {
9 | background-image: url(images/360_F_303367473_rTRc0Cux44BK2qyMLZhLzyzLT0t9J8Y0.jpg);
10 | background-position: center;
11 | background-repeat: no-repeat;
12 | background-attachment: fixed;
13 | background-size: cover;
14 | margin-bottom: 60px;
15 | }
16 |
17 | h2 {
18 | /* color: white; */
19 | font-size: 35px;
20 | align-items: center;
21 | justify-content: center;
22 | }
23 |
24 | .container {
25 | margin: 20px;
26 | padding: 10px;
27 | display: flex;
28 | flex-direction: column;
29 | gap: 15px;
30 | align-items: center;
31 | justify-content: center;
32 | }
33 |
34 | .inputDiv {
35 | margin: 10px;
36 | padding: 5px;
37 | }
38 |
39 | #heroName {
40 | padding: 10px 30px;
41 | font-size: 20px;
42 | }
43 | .wrapper {
44 | display: flex;
45 | gap: 30px;
46 | }
47 |
48 | .btn {
49 | margin: 10px;
50 | padding: 10px 20px;
51 | font-size: 16px;
52 | color: white;
53 | background-image: linear-gradient(to right, #868f96 0%, #596164 100%);
54 | border: none;
55 | border-radius: 4px;
56 | }
57 |
58 | img {
59 | /* box-shadow: 20px 20px 50px 15px grey; */
60 | border-radius: 10px;
61 | }
62 |
63 | .heroInfo {
64 | display: flex;
65 | gap: 30px;
66 | }
67 |
68 | .hero-stat {
69 | display: flex;
70 | flex-direction: column;
71 | gap: 30px;
72 | }
73 |
--------------------------------------------------------------------------------
/api/solution/dogRandom/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | replit
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/api/solution/dogRandom/script.js:
--------------------------------------------------------------------------------
1 | // https://dog.ceo/api/breeds/image/random
2 | // .then - Promises
3 | // asynchronous programming
4 |
5 | // stuff you don't have to wait for
6 | console.log('run 1st')
7 |
8 | const dogImageDiv = document.getElementById('dogImage')
9 | const dogButton = document.getElementById('dogButton')
10 |
11 | // stuff you have to wait for
12 | const getNewDog = () => {
13 | fetch('https://dog.ceo/api/breeds/image/random')
14 | .then(response => response.json())
15 | .then(json => {
16 | dogImageDiv.innerHTML = `
`
17 | })
18 | }
19 |
20 | dogButton.onclick = () => getNewDog()
21 |
22 | console.log('run 3rd')
--------------------------------------------------------------------------------
/api/solution/superHero/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | replit
8 |
9 |
10 |
11 |
12 | 🌟 Super Hero App
13 | You can search for a super hero like "batman" or "thanos" or... You can generate a random hero
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/api/solution/superHero/script.js:
--------------------------------------------------------------------------------
1 | // https://superheroapi.com/api/access-token/character-id
2 |
3 | const SUPERHERO_TOKEN = '837972860711403'
4 | const BASE_URL = `https://www.superheroapi.com/api.php/${SUPERHERO_TOKEN}`
5 |
6 | const newHeroButton = document.getElementById('newHeroButton')
7 |
8 | const heroImageDiv = document.getElementById('heroImage')
9 |
10 | const searchButton = document.getElementById('searchButton')
11 |
12 | const searchInput = document.getElementById('searchInput')
13 |
14 | const getSuperHero = (id, name) => {
15 | // name 👉 base_url/search/batman
16 | // json.results[0].image.url
17 | // id: 👉 base_url/id
18 | // json.image.url
19 | fetch(`${BASE_URL}/${id}`)
20 | .then(response => response.json())
21 | .then(json => {
22 | console.log(json.powerstats)
23 | const superHero = json
24 | showHeroInfo(superHero)
25 | })
26 | }
27 |
28 | const statToEmoji = {
29 | intelligence: '🧠',
30 | strength: '💪',
31 | speed: '⚡',
32 | durability: '🏋️♂️',
33 | power: '📊',
34 | combat: '⚔️',
35 | }
36 |
37 | const showHeroInfo = (character) => {
38 | const name = `${character.name}
`
39 |
40 | const img = `
`
41 |
42 | const stats = Object.keys(character.powerstats).map(stat => {
43 | return `${statToEmoji[stat]} ${stat.toUpperCase()}: ${character.powerstats[stat]}
`
44 | }).join('')
45 |
46 | heroImageDiv.innerHTML = `${name}${img}${stats}`
47 | }
48 |
49 | // 💪 Strength: ${json.powerstats.strength}
🧠 Intelligence: ${json.powerstats.intelligence}
🧠 Combat: ${json.powerstats.intelligence}
🧠 Speed: ${json.powerstats.intelligence}
🧠 Durability: ${json.powerstats.intelligence}
50 |
51 | const getSearchSuperHero = (name) => {
52 | console.log(searchInput.value)
53 | fetch(`${BASE_URL}/search/${name}`)
54 | .then(response => response.json())
55 | .then(json => {
56 | const hero = json.results[0]
57 | showHeroInfo(hero)
58 | })
59 | }
60 |
61 | const randomHero = () => {
62 | const numberOfHeroes = 731
63 | return Math.floor(Math.random() * numberOfHeroes) + 1
64 | }
65 |
66 | newHeroButton.onclick = () => getSuperHero(randomHero())
67 |
68 | searchButton.onclick = () => getSearchSuperHero(searchInput.value)
69 |
--------------------------------------------------------------------------------
/classes/banksClass/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | replit
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/classes/banksClass/script.js:
--------------------------------------------------------------------------------
1 | class Bank {
2 | constructor(balance) {
3 | this.balance = balance
4 | }
5 |
6 | withdraw(amount) {
7 | // guard clause
8 | if (this.balance - amount <= 0) {
9 | console.log('❌ You cannot withdraw more than what you have!')
10 | console.log({balance: this.balance})
11 | return
12 | }
13 |
14 | this.balance -= amount
15 | console.log('withdrew', `$${amount}`)
16 | console.log({balance: this.balance})
17 | }
18 |
19 | deposit(amount) {
20 | this.balance += amount
21 | console.log('deposited', `$${amount}`)
22 | console.log({balance: this.balance})
23 | }
24 | }
25 |
26 | const qaziChecking = new Bank(0)
27 | // console.log(qaziChecking.balance)
28 | // qaziChecking.deposit(10000)
29 | // qaziChecking.deposit(10000)
30 | // qaziChecking.deposit(10000)
31 | // qaziChecking.withdraw(1000)
32 | // qaziChecking.withdraw(20000)
33 | // qaziChecking.withdraw(5000)
34 | // qaziChecking.withdraw(5000)
35 |
36 | const depositButton = document.getElementById('deposit')
37 | const withdrawButton = document.getElementById('withdraw')
38 | const amountInput = document.getElementById('amount')
39 | const balanceDiv = document.getElementById('balance')
40 |
41 | depositButton.onclick = () => {
42 | const amount = Number(amountInput.value)
43 | qaziChecking.deposit(amount)
44 | balanceDiv.innerText = `Balance: ${qaziChecking.balance}`
45 | }
46 |
47 | withdrawButton.onclick = () => {
48 | const amount = Number(amountInput.value)
49 | qaziChecking.withdraw(amount)
50 | balanceDiv.innerText = `Balance: ${qaziChecking.balance}`
51 | }
--------------------------------------------------------------------------------
/classes/carClass/script.js:
--------------------------------------------------------------------------------
1 | // classes: Main topic
2 | // methods
3 | // properties
4 |
5 | // this
6 | class Car {
7 | constructor(name, color, topSpeed) {
8 | // properties
9 | this.name = name
10 | this.color = color
11 | this.topSpeed = topSpeed
12 | this.currentSpeed = 0;
13 | }
14 |
15 | // getters & setters
16 | getCurrentSpeed() {
17 | return currentSpeed
18 | }
19 |
20 | zeroToSixty() {
21 | setTimeout(() => {
22 | console.log('pHEW! That was fast!')
23 | this.currentSpeed = 60;
24 | console.log(this.currentSpeed)
25 | }, 3000)
26 | }
27 |
28 | drive(speed=10) {
29 | // console.log('just drove 2 miles!')
30 | this.currentSpeed += speed
31 | console.log(`driving speed at ${this.currentSpeed} mph`)
32 | }
33 |
34 | brake() {
35 | console.log('braking!')
36 | this.currentSpeed -= 10
37 | }
38 |
39 | stop() {
40 | console.log('coming to a screeching halt!')
41 | this.currentSpeed = 0
42 | }
43 | }
44 |
45 | // porsche, 'yellow', 250
46 |
47 | const ferrari = new Car('ferrari', 'red', 250)
48 | ferrari.drive()
49 | ferrari.drive()
50 | ferrari.drive()
51 | ferrari.drive()
52 | ferrari.drive()
53 | console.log(ferrari.currentSpeed)
54 | ferrari.brake()
55 | ferrari.stop()
56 | console.log(ferrari.currentSpeed)
57 |
58 | const porsche = new Car('Porsche', 'yellow', 250)
59 | console.log(porsche.name)
60 | console.log(porsche.color)
61 | console.log(porsche.topSpeed)
62 | // const nums = [1, 2, 3, 4, 5]
63 | // nums.forEach(_ => porsche.drive())
64 | porsche.drive(40)
65 | porsche.drive(80)
66 | console.log(porsche.currentSpeed)
67 | porsche.zeroToSixty()
68 | porsche.stop()
69 | console.log(porsche.currentSpeed)
70 |
71 | // console.log(ferrari.name)
72 | // console.log(ferrari.color)
73 | // console.log(ferrari.topSpeed)
74 |
75 | // console.log(ferrari.currentSpeed)
76 |
77 | // ferrari.drive()
78 | // ferrari.brake()
79 |
80 | // console.log(ferrari.currentSpeed)
81 | // ferrari.drive()
82 | // console.log(ferrari.currentSpeed)
83 | // ferrari.drive()
84 | // ferrari.drive()
85 | // console.log(ferrari.currentSpeed)
86 | // ferrari.zeroToSixty()
87 | // console.log(ferrari.currentSpeed)
88 |
89 | // console.log(ferrari)
90 |
91 | // you can only have methods inside of classes
92 | // const numbers = [1, 2, 3]
93 | // numbers.push(4) // method
94 | // // console.log(typeof )
95 | // console.log(numbers)
96 |
97 | Array.prototype.myPush = function(item) {
98 | this[this.length] = item
99 | return this
100 | }
101 |
102 | const fruits = ['🍌', '🍓', '🍪', '🍐', '🍎']
103 | fruits.myPush('🥝')
104 | fruits.myPush('🍪')
105 | fruits.myPush('🍓')
106 | fruits.myPush('🍊')
107 | console.log(fruits)
--------------------------------------------------------------------------------
/dom/red-yellow-green/index.html:
--------------------------------------------------------------------------------
1 |
2 |
Hello Night!
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/dom/red-yellow-green/script.js:
--------------------------------------------------------------------------------
1 | console.log('hello')
2 |
3 | let titleDiv = document.getElementById('title')
4 |
5 | console.log('before: ', titleDiv.innerText)
6 |
7 | let message = 'Square Color Counter 🚀'
8 |
9 | titleDiv.innerText = message;
10 |
11 | console.log('after: ', titleDiv.innerText)
12 |
13 | titleDiv.innerHTML = `${message}
`
14 |
15 | titleDiv.style.backgroundColor = 'blue'
16 |
17 | const squares = document.querySelectorAll('.colorSquare')
18 |
19 | // forEach
20 | const timesClicked = {'red': 0, 'yellow': 0, 'green': 0}
21 | squares.forEach(square => {
22 | square.onclick = () => {
23 | timesClicked[square.value] += 1
24 | square.innerText = timesClicked[square.value]
25 | }
26 | })
27 | function clearScores() {
28 | timesClicked.red = 0
29 | timesClicked.yellow = 0
30 | timesClicked.green = 0
31 | squares.forEach(square => {
32 | square.innerText = ''
33 | })
34 | }
35 |
36 | const clearGameBtn = document.getElementById('clear-game')
37 | clearGameBtn.onclick = () => clearScores()
38 |
39 |
--------------------------------------------------------------------------------
/exercises/arraysorting.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉
3 |
4 | // Write a function that takes in an array and sort the numbers inside from least to greatest
5 |
6 | function sortArray(arr) {
7 | for (let i = 0; i < arr.length; i++) {
8 | for (let j = 0; j < arr.length; j++) {
9 | if (arr[j] > arr[j + 1]) {
10 | temp = arr[j];
11 | arr[j] = arr[j + 1];
12 | arr[j + 1] = temp;
13 | }
14 | }
15 | }
16 | }
17 |
18 | // let arr = [2, 5, 8, 3, 6, 9, 1, 4, 7];
19 | // console.log(arr);
20 | // sortArray(arr);
21 | // console.log(arr);
22 | // BONUS sort the array without using .sort()
23 |
--------------------------------------------------------------------------------
/exercises/converthourstoseconds.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉 https://replit.com/@CleverLance/ConvertHoursToSeconds#solution.js
3 |
4 | // https://www.loom.com/share/3de1aa5d007047ef82652530f04600b1
5 |
6 | // Write a function that takes a parameter (hours) and converts
7 | // it to seconds
8 |
9 | function howManySeconds(hours) {
10 | // Your function should return an integer
11 | // of how many seconds are in the hour
12 | let min = hours * 60;
13 | let sec = min * 60;
14 | return sec;
15 | }
16 |
17 | // console.log(howManySeconds(10));
18 | //Topics: Variables,functions, Math
19 |
20 |
--------------------------------------------------------------------------------
/exercises/daysinamonth.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉
3 |
4 | // Create a function that takes the month and year (as integers)
5 | // and returns the number of DAYS in that month
6 |
7 | // Hints:
8 | // Don't forget about leap year!
9 | // Keep in mind which month has 30 days, 31 days, and 28 days
10 | // Use everything you learned to get to the answer
11 |
12 | const daysInMonth = (month, year) => {
13 |
14 | }
15 |
16 | // Example:
17 | // daysInMonth(2, 2018) -> 28
18 | // days(4, 654) -> 30
19 | // days(2, 2020) -> 29
--------------------------------------------------------------------------------
/exercises/findMax.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉
3 |
4 | // Write a function that takes in an array of numbers and returns the largest number
5 |
6 | function findMax (array) {
7 | let max = array[0];
8 | for(const num of array){
9 | if(num > max){
10 | max = num;
11 | }
12 | }
13 | return max;
14 | }
15 |
16 | let array = [1,4,72,5,83,6,9];
17 | console.log(findMax(array));
18 | //Topics: loops, arrays, conditions,
--------------------------------------------------------------------------------
/exercises/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Loop and Array Assignment
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/exercises/palindromechecker.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉
3 |
4 |
5 | // Write a function that takes in string and checks if it is a Palindrome
6 | // A palindrome is a word that is the same forwards and backwards!
7 | // Ex: racecar -> racecar
8 |
9 | function isPalindrome (string) {
10 | let i = 0;
11 | let j = string.length -1 ;
12 | while(i < j){
13 | if(string.charAt(i) != string.charAt(j)){
14 | return false;
15 | }
16 | else{
17 | i++;
18 | j--;
19 | }
20 | }
21 | return true;
22 | // Should return true IF it's a palindrome
23 | }
24 |
25 | let string = 'hellolleh';
26 | console.log(isPalindrome(string));
27 |
28 | //Topics: Strings, loops
--------------------------------------------------------------------------------
/exercises/savingsstrategy.js:
--------------------------------------------------------------------------------
1 | // Test you code by forking this repl:
2 | // 👉
3 |
4 |
5 | // The 50-30-20 strategy is a simple way to budget
6 | // which involves spending 50% of after-tax income on needs,
7 | // 30% after tax income on wants,
8 | // 20% after-tax income on savings or paying off debt.
9 |
10 | // Create a function that takes an income amount and return an OBJECT with what they have for needs, wants, and savings
11 |
12 | function savingsStrategy (income) {
13 |
14 | }
15 |
16 | // Ex:
17 | // Input: fiftyThirtyTwenty(10000)
18 | // Output: { "Needs": 5000, "Wants": 3000, "Savings": 2000 }
19 |
20 |
21 | //Topics: Objects
--------------------------------------------------------------------------------
/functions/sum/exercise/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | replit
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/functions/sum/exercise/script.js:
--------------------------------------------------------------------------------
1 | /*
2 | TODO: Write a function that sums two numbers
3 | TODO: Write a function that subtracts two numbers
4 | TODO: Write a function that divides two numbers.
5 | TODO: Write a function that multiplies two numbers.
6 | *NOTE* be sure to handle dividing by zero 😉
7 | ES5 Syntax: function Add(){}
8 | ES6 Syntax (Arrow function): const add = () => {}
9 | */
10 |
11 | function add(a, b) {
12 | return a + b;
13 | }
14 |
15 | function sub(a, b) {
16 | return a - b;
17 | }
18 |
19 | function div(a, b) {
20 | if(b==0){
21 | console.log("cannot divide by 0")
22 | return;
23 | }
24 | return a / b;
25 | }
26 |
27 | function mul(a, b) {
28 | return a * b;
29 | }
30 |
31 | // ES6 version of functions
32 |
33 | const addArrow = (a, b) => a + b;
34 |
35 |
36 | const subArrow = (a, b) => a - b;
37 |
38 |
39 | const divArrow = (a, b) => a / b;
40 |
41 |
42 | const mulArrow = (a, b) => a * b;
43 |
44 |
45 | console.log('hello from the SUM exercise')
46 | /*
47 | TODO: create a function that console logs the result of any of the above operations.
48 | */
49 |
50 | console.log(addArrow(20, 50));
51 | console.log(subArrow(20, 50));
52 | console.log(mulArrow(20, 50));
53 | console.log(div(20, 0));
--------------------------------------------------------------------------------
/functions/sum/solution/index.html:
--------------------------------------------------------------------------------
1 |
2 | Sum - Solution
3 |
4 |
5 |
6 |
7 |