javascript-course's People
Forkers
udi1990 henryjordankevin tilak-raj-bhatt ralds-es6 ian-25 onodera20 razdy-30 lokial vaishna1102 caodadanac moseliem79 bathazarepaige naveen-nawin marlen-sim collinsic oluwaseg a1ip christophermwiya ozi-sadiq-kasai plewinho javabynainekhan qasimtook pedro-zarate cilsocarvalho crisrivera07 lucasr81 vuminhphuong wilsonoluwafemi adwait-pujari pramee08 ashish93-mrx nbd111m nancynarang gledianmeta rtjrrt alexyouthere galaxy66 zimmermanjosh cgreen9639-ux chanawin-kmpn derrickmura mohdfaizan5 spiritofprophecy ecurb23 johnshokry chrubsie malazuk isanakasaikumarreddy thinesh-12 lakobby j-hashimo slalp danielerfort donald-ning divyadarshini04 thatitbabe deepakkandpal2796 elites100 jithinio juniperlatte1 shashiaitha03 kantaphonkit victor-jacques amanchanagaraju obony ahteshamuddowla suvani222 rvssianmob saumyabsl julialiani zachniederstadt musak123 wpromel abdullahi205 ndahisaac alisheralseiit lucashuynh213 radriverron redwan528 robert558 peternguyen1996 spaulsen-creator wfd2018 justine-5 gatkuoth-nyuot meydanturku wfd2018-wfd2018 sirenej23 airbird95 gabthegreat25 mkiskrazy amitkanwar92 donasiby umalatpy dibya112 piya-gh lamthaithanhlong techwhizvanshita saharrshirazii innovatorbrainjavascript-course's Issues
SyntaxError
I couldn't understand this error //// Uncaught SyntaxError: "undefined" is not valid JSON
at JSON.parse ()
at 10-rock-paper-scissor copy.html:43:27 ////
let scores = JSON.parse(localStorage.getItem('scores')) || {
wins:0,
losses:0,
ties:0
};
.
.
.
.
localStorage.setItem('scores', JSON.stringify(scores));
Lesson 14
Please does anyone have a comprehensive solution to the problem in lesson 14, I noticed that the cart disappears when I added local storage.
Here is the problem I am encountering:
Uncaught TypeError: Cannot read properties of undefined (reading 'id')
at checkout.js:20:48
at Array.forEach ()
at checkout.js:7:6Understand this error
Here is my code for checkout.js:
import {cart, removeFromCart} from '../data/cart.js';
import {products} from '../data/products.js';
import {formatCurrency} from './utils/money.js';
let cartSummaryHTML = '';
cart.forEach((cartItem) => {
const productId = cartItem.productId;
let matchingProduct;
products.forEach((product) => {
if (product.id === productId) {
matchingProduct = product;
}
});
cartSummaryHTML += `
Delivery date: Tuesday, June 21
<div class="cart-item-details-grid">
<img class="product-image"
src="${matchingProduct.image}">
<div class="cart-item-details">
<div class="product-name">
${matchingProduct.name}
</div>
<div class="product-price">
$${formatCurrency(matchingProduct.priceCents)}
</div>
<div class="product-quantity">
<span>
Quantity: <span class="quantity-label">${cartItem.quantity}</span>
</span>
<span class="update-quantity-link link-primary">
Update
</span>
<span class="delete-quantity-link link-primary js-delete-link" data-product-id="${matchingProduct.id}">
Delete
</span>
</div>
</div>
<div class="delivery-options">
<div class="delivery-options-title">
Choose a delivery option:
</div>
<div class="delivery-option">
<input type="radio" checked
class="delivery-option-input"
name="delivery-option-${matchingProduct.id}">
<div>
<div class="delivery-option-date">
Tuesday, June 21
</div>
<div class="delivery-option-price">
FREE Shipping
</div>
</div>
</div>
<div class="delivery-option">
<input type="radio"
class="delivery-option-input"
name="delivery-option-${matchingProduct.id}">
<div>
<div class="delivery-option-date">
Wednesday, June 15
</div>
<div class="delivery-option-price">
$4.99 - Shipping
</div>
</div>
</div>
<div class="delivery-option">
<input type="radio"
class="delivery-option-input"
name="delivery-option-${matchingProduct.id}">
<div>
<div class="delivery-option-date">
Monday, June 13
</div>
<div class="delivery-option-price">
$9.99 - Shipping
</div>
</div>
</div>
</div>
</div>
</div>
`;
});
document.querySelector('.js-order-summary')
.innerHTML = cartSummaryHTML;
document.querySelectorAll('.js-delete-link')
.forEach((link) => {
link.addEventListener('click', () => {
const productId = link.dataset.productId;
removeFromCart(productId);
const container = document.querySelector(
`.js-cart-item-container-${productId}`
);
container.remove();
});
});
Code for cart.js:
export let cart = JSON.parse(localStorage.getItem('cart'));
if (!cart) {
cart = [{
productId: 'e43638ce-6aa0-4b85-b27f-e1d07eb678c6',
quantity: 2,
}, {
productId: '15b6fc6f-327a-4ec4-896f-486349e85a3d',
quantity: 1
}];
}
function saveToStorage() {
localStorage.setItem('cart', JSON.stringify(cart));
}
export function addToCart(productId) {
let matchingItem;
cart.forEach((cartItem) => {
if (productId === cartItem.productId) {
matchingItem = cartItem;
}
});
if (matchingItem) {
matchingItem.quantity += 1;
} else {
cart.push({
productId: productId,
quantity: 1
});
}
saveToStorage();
}
export function removeFromCart(productId) {
const newCart = [];
cart.forEach((cartItem) => {
if (cartItem.productId !== productId) {
newCart.push(cartItem);
}
});
cart = newCart;
saveToStorage();
}
12i task
I put them together.Is that fine?yeah, it's fine for now.
I put them together.Is that fine?
Originally posted by @verakissyou17 in #32 (comment)
Lesson8 Exercise 8h
please i need solution for project 3
please i’ll need help on the last problem in project 3
TypeError: Cannot read properties of null (reading 'value'
When I tried console.log(quantity)
I received the error message "TypeError: Cannot read properties of null (reading 'value')
at HTMLButtonElement. (amazon.js:75:46)"
3j.js
Hi,
is the \n missing from the 3j answer or am I just being stupid?
Here's your solution: alert(Total cost: $${(599 + 295) / 100} Thank you, come again!
);
This is what I wrote: alert(Total cost: $${(599 + 295) / 100}
+ \nThank you, come again!
);
Thank you for a good course and keep up the good work!
Exercise 7f
Hello, I did this exercise that way below. It is wrong? work the same way that yours.
<title>Conversor de Temperatura</title><script>
function convertTemperature (degrees,unit){
if (unit === 'F') {
const result = (degrees - 32) *5 / 9
console.log(`'${result}C'`);
} else if (unit === 'C') {
const result2 = (degrees *9 / 5) + 32
console.log(`'${result2}F'`);
}
}
convertTemperature (86, 'F');
</script>
15i-soln
the solution doesnot updates the items when updating the code, we have to refresh it
Lesson-13 done by someone and saved to this repo?
Hello!
I download starting files from lesson 13, but files looks updated. Like someone done Lesson-13 and post files here.
about chapters in the video
can you please add chapters back in the video preview , it makes it hard to follow through the course
Exercise 14j
Greetings sir, I really appreciate you what you been in my coding journey. I haven't met you before but it seems to me like you are my old friend and your teaching skills is wonderful.
I really don't know while the particular exercise 14j solution is not removing the class list 'is-editing-quantity'. Please someone should help me because I have been stuck here a week now😭
Lesson 13 - Add to cart is giving NaN
@SuperSimpleDev When we add the products to the cart its showing as NaN
Found a issue in the 8h.html (Undefined value is stored after hitting the '=' button)
lesson 8k, syntax error
Questioning the use of eval(), security issue?
A quick search on mdn web docs tells me eval() is a huge security risk and is slower than the alternatives.
I understand for beginners' sake this might be an easier way to make a calculator. But if the aim is to go from beginner to pro, why isn't a warning given to the students regarding eval()'s security risk, or even discussed at all. I still see eval() being in the course solution up to lesson 10.
Why is this?
12g.html (javascript-course)
With reference to exercise 12q, there is no onclick attribute in 12g.html.
Hey Simon, How can i fix this problem it take too much time, but it didn't solve, but I got one solution which is [ 'cart', '[{"productId":"e43638ce-6aa0-4b85-b27f-e1d07eb678c6","quantityValue":1,"deliveryOptionId":"1"},{"productId":"15b6fc6f-327a-4ec4-896f-486349e85a3d","quantityValue":2,"deliveryOptionId":"1"}]' ] this is only one way, but it has a one problem, if i change any thing or any error but it didn't show this error, please fix this problem and upload short video how to solve this problem, please, please
Issue with Lesson-11 (11u.html)
In lines 24 and 29, reversedFood should have been used instead of foods.
for (let i = 0; i < reversedFoods.length; i++) {
if (reversedFoods[i] === 'egg' && eggsRemoved < 2) {
eggsRemoved++;
continue;
}
result.push(reversedFoods[i]);
I am stuck at lesson 16J
Hi everyone, I have an issue with problem 16j. The problem requires people to have an interactive update button to continue. However, I used a copy of the lesson 16 code from SuperSimpleDev, and the code doesn't have an interactive update button. Someone, please give me the solution to problem 16j, and then I can continue the exercise. I am hard stuck right now. Thank you guys in advance
Lesson 16 Testing FrameWork
exercise 8k i checked my code and its the same but still giving error
<!DOCTYPE html>
<html>
<head>
<title>Coin Flip</title>
</head>
<body>
<button onclick="
playGame('HEADS');
">Heads</button>
<button onclick="
playGame('TAILS');
">Tails</button>
<script>
const score = JSON.parse(localStorage.getItem('score')) || { wins: 0, losses: 0 };
function playGame(guess) {
const randomNumber = Math.random();
const result = randomNumber < 0.5 ? 'HEADS' : 'TAILS';
console.log(`ITS ${result}!`);
console.log(guess === result ? 'You Win!' : 'You Lose!');
guess === result ? score.wins++ : score.losses++;
console.log(score);
localStorage.setItem('score', JSON.stringify(score));
}
</script>
</body>
</html>
Lesson 13
How do i generate the Id in product.js.
Const product = [{
id:
name:
}]
Database, server side JS and APIs?
I don't know the full course, I am at lesson 14 and I haven't found a lessons list. When we will get to database and js integrations, server side JS (node.js?) And creation and use of APIs? I really like how the course is explained and I would like to stick with it also for these topics
Problem on the Rock paper scissors projects
I have an error on rock paper scissors projects then rock image does not appear on the screen and I will inspect there is no erron on the console and also in vs code but the image is not appearing and what's is the problem I will try to clear the problem and the next error will appear I will spend more time to solve this but the error will not solved
How can I solve this error
I am not sure where the issue is but the jasmine test system is not recognizing the source file to test.
here I am attaching the info. to debug the issue:
want to test the priceformatter function the code organization is quite similar to the tutorial , the code is also same from the tutorial however the monerTest.js file is in the spec folder which i have given the path to recognize it as a script , code moneyTest.js : import { priceFormatter } from "../../scripts/utils/money";
console.log("test suit: formatcurrancy");
describe('test suit: fromate currancy', () => {
it('convert cents into dollars', () => {
expect(priceFormatter(2095)).toEqual(20.95);
});
});,
test.js :
<title>Jasmine Spec Runner v5.1.1</title> <script src="lib/jasmine-5.1.1/jasmine.js"></script> <script src="lib/jasmine-5.1.1/jasmine-html.js"></script> <script src="lib/jasmine-5.1.1/boot0.js"></script> <script src="lib/jasmine-5.1.1/boot1.js"></script> <script src="spec/moneyTest.js" type="module"></script> .error; Incomplete: No specs found, , randomized with seed 48042
lesson 10 bug
https://supersimple.dev/projects/dom-with-css/
line 114
it is written that under 40 + 10 but in code under 35
This problem is only on suspersimle.dev
In code from 10 lesson all ok
Variable Section ( -= ) ShortHand Operator
It's not a bug or something, I just find out that I could do the empty cart on another way, so yeah.
<button onclick="showQuantity -= showQuantity;
console.log('Cart Reset ')">Reset Cart </button>
Lesson 18 (Backend Documentation)
Hey Dev, When I try to place order on Checkout page then it show the error in console (400 Bad Request) for this API =https://supersimplebackend.dev/orders ,can you provide solution for this..
document.querySelector('.js-place-order').addEventListener('click', async ()=>{
const response=await fetch('https://supersimplebackend.dev/orders',{
method:'POST',
headers:{
'Content-Type':'application/json'
},
body: JSON.stringify({
cart: cart
})
});
const order= await response.json();
console.log(order);
});
****
Not mentioning "product3" but the code still works correctly.
function isSameProduct(product1, product2){
if(product1.name === product2.name && product1.price === product2.price){ **Here I wrote product1 and product2 but nothing about
product 3 (below), the code still works correctly because it
looks at the properties and not at the object name itself ?**
return true;
} else{
return false;
}
}
const product1 = {
name: 'ball',
price: 200
};
const product2 = {
name: 'arrow',
price: 200
};
const product3 = {
name: 'ball',
price: 200
};
console.log(isSameProduct(product1, product2));
console.log(isSameProduct(product1, product3));
</script>
quantity issue
lesson 10 bug
document.querySelector('.js-moves').innerHTML = You <img src="images/${playerMove}-emoji.png" class="move-icon"> <img src="images/${computerMove}-emoji.png" class="move-icon"> Computer
;
the above code is not working, I have tried to fix it but it won't work. please help.``
lesson 11 loops and arrays
i tried every thing also i copied your code to my code editor and still can't run the code correctly
stuck at exercise 8i
<!DOCTYPE html>
<html>
<head>
<title>Coin Flip</title>
</head>
<body>
<button onclick="
flippingCoin('HEADS');
">Heads</button>
<button onclick="
flippingCoin('TAILS');
">Tails</button>
<script>
let randomNumber = Math.random();
let result;
let guess;
function flippingCoin(guess) {
if (randomNumber < 0.5) {
result = 'HEADS';
} else {
result = 'TAILS';
}
console.log(result);
if (guess === result) {
console.log('You Win!');
} else if (guess !== result) {
console.log('You Lose!');
}
}
</script>
</body>
</html>
"13m Solution with closure" is not working properly like the "13m Solution with object"
13m Solution with closure: this line "let addedMessageTimeoutId" that is declared outside the loop doesn't achieve the expected result. But when I move inside the loop, it works fine. From what I asked chatGPT, even though this is a more advanced solution, the solution using objects is better in terms of scalability and maintainability. Can I get your opinion on this?
`if(!cart)` -> `if(!cart.length < 1)`
Cart is not getting its default value after emptying. Anyone also encounter it? If not, I need your help
i spent over 3 days over 18hours to fix this but i can't pls help me to fix this on lesson 14
here is what am facing it in the console tab the check out page is not working pls simon simplify the tech world
Uncaught TypeError: Cannot read properties of undefined (reading 'id')
at checkout.js:20:48
at Array.forEach ()
at checkout.js:7:6
NO SOLUTIONS for the projects
There are 3 projects at the end of the video.
I am struggling with the third one. I have to indicate that a todo is done with a checkbox.
But if I refresh the page, it resets the 'checked' checkbox resets to 'unchecked'.
I tried localStorage, but it doesn't work.
And I literally can't find the solution in the GitHub repo for any of the projects. Are they here?
cannot redeclare blocked-scoped variable 'randomNumber'.
Rock Paper Scissors
Lesson 13
In the lesson 13, when i added the item into the cart it shows me a “NAN” instead of the number.
console.log(localStorage) is returning "null"
SCREENSHOT Above
CODE below
import { addToCart, cart } from '../../data/cart.js';
describe('test suite: addToCart', () => {
it('adds and exisiting product to the cart', () => {
});
it('add a new product to the cart', () => {
spyOn(localStorage, 'getItem').and.callFake(() => {
return JSON.stringify({});
});
console.log(localStorage.getItem('cart'));
addToCart('e43638ce-6aa0-4b85-b27f-e1d07eb678c6');
expect(cart.length).toEqual(1);
});
});
From - Lesson 16 (Testing)
Using Jasmine Testing Framework
The above lines of code is supposed to display an empty array in the console since the code is supposed to spyOn locaStorage('getItem')and call fake the cart array, but instead it's returning "null" in the console. I don't know where I went wrong. I need assistance, I have been trying to solve this issue for the past 3 days now.
Thanks.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.