Local storage shopping cart. | Insert, update, remove products from the browser's local storage.

  Рет қаралды 28,358

Digital Fox

Digital Fox

Күн бұрын

Пікірлер: 31
@spondoolie6450
@spondoolie6450 2 жыл бұрын
Every once in a while you search through KZbin and find a channel that is new, but you know it will clearly get huge one day based on the content and quality. Today I found that channel. Subbed 💪
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you
@oluwafemiolukoya9352
@oluwafemiolukoya9352 2 жыл бұрын
the most straightforward local storage tutorial I've watched on here well done!
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you
@adotornado-e4o
@adotornado-e4o 2 жыл бұрын
Exactly what I needed, thank you.
@FranciscoUberto
@FranciscoUberto 2 жыл бұрын
amazing video, very well done. Super clear and effective. thank you so much
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you, glad you liked it!
@nuralomislam8364
@nuralomislam8364 2 жыл бұрын
superb presentation bro.. keep it up
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you so much 🙂
@naijacanact8153
@naijacanact8153 2 жыл бұрын
Impressive presentation
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you!
@krisNemeth55
@krisNemeth55 2 жыл бұрын
great tutorial dude! One question though: why did we added the function to increase quantity if then at the end it doesn't count towards the total price? I feel it won't be so far off to be able to update the price with the quantity in mind?
@krisNemeth55
@krisNemeth55 2 жыл бұрын
solved it! let temp = cart.map(function(item){ return parseInt(item.price * item.quantity) }) yaaay!
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Nice work. Yes i spotted the error to so i added in the description a line of code to update the price when i update the quantity.
@krisNemeth55
@krisNemeth55 2 жыл бұрын
@@DigitalFox-tutorials I never found that, managed to sort it without. Thanks for the help! Now time to wire everything up to buttons and selects :')
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Happy coding
@bhanukadasanayaka3457
@bhanukadasanayaka3457 2 жыл бұрын
you earned one sub👌🏻
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Thank you
@PokemonGo-re7ue
@PokemonGo-re7ue Жыл бұрын
What would the code look like if you wanted more items of the same type in the cart?
@DigitalFox-tutorials
@DigitalFox-tutorials Жыл бұрын
Hey, we wouldn't check if the product already exist in the cart. So we don't need the else clause in the "addItemToCart" function. else{ let res = cart.find(item => item.id == productId); if(res === undefined){ cart.push(product); } }
@PokemonGo-re7ue
@PokemonGo-re7ue Жыл бұрын
@@DigitalFox-tutorials Thank you so much for the reply
@georgejuarez660
@georgejuarez660 Жыл бұрын
Nice video but i just have one question: how can i output json file results (from cart) into html page with local storage?
@DigitalFox-tutorials
@DigitalFox-tutorials Жыл бұрын
Hey, check this short post out . digitalfox-tutorials.com/tutorial.php?title=How-browser%27s-local-storage-works I hope it helps.
@andyandy1950
@andyandy1950 2 жыл бұрын
the only question arises is what about security , if i change price of an item in html for example then its gonna take wrong data
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Yes you are right, that's why we never use data from the local storage or fetch them from the html code in the checkout page. We pull them from the database or where ever we store them in the server. Using the local storage gives the user a fast user experience. As for the security we always use a server side language. I wanted to show you the logic behind storing a shopping cart in the browser.
@brok_than2901
@brok_than2901 2 жыл бұрын
hello Digital Fox am thanos
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Hi Thanos
@brok_than2901
@brok_than2901 2 жыл бұрын
@@DigitalFox-tutorials hi
@MohamedTarek-kl5hf
@MohamedTarek-kl5hf Жыл бұрын
clear as fuck
@billi5920
@billi5920 2 жыл бұрын
wtf is a " promise " ?
@DigitalFox-tutorials
@DigitalFox-tutorials 2 жыл бұрын
Check this out developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise developer.mozilla.org/en-US/docs/Web/API/Fetch_API
Learn localStorage in JavaScript by building a project!
31:14
Max Programming
Рет қаралды 51 М.
LocalStorage for beginners (HTML and Javascript)
12:27
iEatWebsites
Рет қаралды 58 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
JavaScript Cookies vs Local Storage vs Session Storage
14:28
Web Dev Simplified
Рет қаралды 770 М.
Storing Objects with Local Storage in JavaScript
6:58
dcode
Рет қаралды 175 М.
Fetching Data Doesn't Get Better Than This
6:58
Josh tried coding
Рет қаралды 142 М.
React Custom Hooks: useLocalStorage - Simply Explained!
10:27
Cosden Solutions
Рет қаралды 29 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
14 Context API with local Storage
1:08:19
Hitesh Choudhary
Рет қаралды 16 М.
Are we going back to PHP with fullstack JavaScript?
9:57
Maximilian Schwarzmüller
Рет қаралды 160 М.