Тёмный

Learn localStorage in JavaScript by building a project! 

Max Programming
Подписаться 4,9 тыс.
Просмотров 50 тыс.
50% 1

Hello, my friends and fellow developers,
Let me know in the comments below if you want more JavaScript videos or any other videos. And like the video, if you like it.
🔴 Subscribe here: bit.ly/2K5Ydaf
⌨ Localhost Discord Server: / discord
Links in the video:
🔥 Starter code: github.com/max...
Other Tutorials:
⚛️ React and Material UI Todo App: bit.ly/reactma...
🟨 Other JavaScript videos: bit.ly/jstutor...
📘 Visual Studio Code videos: bit.ly/vscodevids
🔋 Build a Battery App in JS: • 🔋 Build a Battery Info...
Connect 🔗 :
Twitter: / maxprogramming1
Facebook: / max-programming-103081...
Github: github.com/max...
🎥 Gear I use:
🎤 Mic: amzn.to/3DGqEH9
🎙️ Mic Holder: amzn.to/3NAnM2U
🎧 Headphones: amzn.to/3Wy7CuZ
⌨ Keyboard: amzn.to/3E2mSci
📷 Webcam: amzn.to/3Tb0Ice
VS Code Theme used: Default Dark+
Font used: Cascadia Code
Suggest, ask doubts in the comments and share these videos to help!
Thanks for Watching!
#javascript #webdev #coding

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 136   
@JamesQQuick
@JamesQQuick 3 года назад
Fantastic demo!!
@MaxProgramming
@MaxProgramming 3 года назад
Thank you so much for subscribing 😍
@gargichaudhary8390
@gargichaudhary8390 3 года назад
This is first ever video i am commenting on...... you just sorted the topic
@MaxProgramming
@MaxProgramming 3 года назад
Happy to know that Gargi 😀!
@devarshidwi
@devarshidwi 2 года назад
Thank you so much, I was making a toDo app this is what I was looking for, you made a project unlike other youtubers who only explain basics of localStorage. ❤
@MaxProgramming
@MaxProgramming 2 года назад
I'm glad it was useful 🙂.
@nigelflim
@nigelflim 2 года назад
Fantastic tutorial on localStorage, definitely the best on youtube
@MaxProgramming
@MaxProgramming 2 года назад
Thank you so much 😊
@alphamx13
@alphamx13 10 месяцев назад
It isn't secure but still is awesome! 👍
@omargian_stw1305
@omargian_stw1305 2 года назад
Thanks ! This is very helpful and easy to understand.
@keifer7813
@keifer7813 2 года назад
This is exactly what I needed. Jazak allahu khair, Usman. Very nicely explained!
@MaxProgramming
@MaxProgramming 2 года назад
Aameen brother 😄
@dawnbroadbent
@dawnbroadbent 2 года назад
This is the first tutorial that actually saves the 2D array to local storage and doesn't overwrite it! Cudos!
@CodeJourneyAbubaida1994
@CodeJourneyAbubaida1994 7 месяцев назад
I love your lectures
@devking549
@devking549 3 года назад
Wow! I am subscribing! Can you tell how did you make your web-cam circular?
@MaxProgramming
@MaxProgramming 3 года назад
Thanks! Yes I used a circular overlay and used it in OBS. Search for a video on RU-vid for a guide. 👍
@listenthequranandfeelhappi8936
Hey brother Usman which theme or font are you using . It looks very nice Please make a video on that
@MaxProgramming
@MaxProgramming Год назад
Thanks. I always mention the theme and font in my video description. In this video i used default theme and cascadia code font
@kanaung.academy
@kanaung.academy 2 года назад
Hey, this one really saved the day for me. I've seen many videos around localStorage but I dare to say this one is the best.
@MaxProgramming
@MaxProgramming 2 года назад
Thank you so much for your kind words 😄
@kanaung.academy
@kanaung.academy 2 года назад
Hello bro, would you kindly make a video about deleting and editing items with "local storage", maybe like a note app?
@MaxProgramming
@MaxProgramming 2 года назад
@@kanaung.academy Thanks for the suggestion. I'll try my best to cover this topic as soon as possible 😃
@Mary-k2p
@Mary-k2p 2 месяца назад
Just found your channel. You explain things so well, really! Kudos. I'll watch your other videos. I subscribe to this. Thank you.
@MaxProgramming
@MaxProgramming 2 месяца назад
@@Mary-k2p Thank you for your kind words
@Mary-k2p
@Mary-k2p 2 месяца назад
@@MaxProgramming You're welcome. Please don't stop making videos like this; explaining concepts practically.
@atticuus
@atticuus Год назад
thanks
@mdshayemurrahman9
@mdshayemurrahman9 2 года назад
I was creating a to-do app project by myself and I needed to learn localStorage. This tutorial was truly amazing. Now, I subscribed. Please, Keep up the good work!
@MaxProgramming
@MaxProgramming 2 года назад
Thank you so much 🤘
@minkhantsaw0428
@minkhantsaw0428 2 года назад
Thanks bro very clear and easy to understand 😊
@sunritjana4573
@sunritjana4573 3 года назад
Awesome video!! :D Nice seeing you again after a long time 😁😁
@MaxProgramming
@MaxProgramming 3 года назад
Thanks! You too!
@invinciblevikas9553
@invinciblevikas9553 Год назад
Great work
@omargian_stw1305
@omargian_stw1305 2 года назад
everything work fine but I'm adding extra input element a dropdown select option, but shows up undefined, how can i solve this? Thanks
@MaxProgramming
@MaxProgramming 2 года назад
Selecting options for a dropdown is a little bit different from the input element. Make sure that the data you are getting from local storage actually exists by going to the devtools and Application tab. Undefined means the variable you are referencing does not exist
@MaxProgramming
@MaxProgramming 2 года назад
stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript Look at this to learn how to get text from dropdown
@omargian_stw1305
@omargian_stw1305 2 года назад
​@@MaxProgramming Thank for your quick answer, I just solved, The problem was that I have to add a name atribute in the select tag, and then just save it like you did in the video.
@dawnbroadbent
@dawnbroadbent 2 года назад
...also, how does your form fields reset without a .reset() code?
@MaxProgramming
@MaxProgramming 2 года назад
At 22:35 I set thr values of the inputs to an empty string manually. At that time I think I wasn't aware of the reset method.
@timjim2145
@timjim2145 2 года назад
Thank you my dear. This Video helped me so much and you explained it very well with your enjoyable voice. Greatings from Germany.
@rish_you
@rish_you Год назад
it is showing createstudentelement is not defined
@MaxProgramming
@MaxProgramming Год назад
Can you reply below with your code?
@rish_you
@rish_you Год назад
@@MaxProgramming solved..thankyou
@simrangupta6987
@simrangupta6987 2 года назад
How to edit json file in local storage
@MaxProgramming
@MaxProgramming 2 года назад
JSON files aren't stored in local storage. Strings are stored. Can you elaborate your question?
@foreign-livingtheamericand8782
can localstorage work in cpanel?
@MaxProgramming
@MaxProgramming Год назад
As far as i know cpanel is something server side. And local storage is only for client side browser javascript. So if you use localstorage in script tags or js files that run in the browser, you're good to go
@danish7335
@danish7335 Год назад
I love this tutorial and this guy.. Keep going usman we are standing behind u to support i love the explanation....
@imok5746
@imok5746 Год назад
masha Allah brother thanks you helped me a lot very smart & simpel
@funterban6536
@funterban6536 2 года назад
Make a video in urdu or hindi please
@MaxProgramming
@MaxProgramming 2 года назад
Thank you for the suggestion. I will try to do so maybe in the future on a different channel 🙂
@belindacrichlow1791
@belindacrichlow1791 Год назад
Thank you very much. Now I can complete my final project for my bootcamp
@sudhakarvasa2688
@sudhakarvasa2688 3 года назад
In my opinion this is the best JS demo for using local Storage . well done
@MaxProgramming
@MaxProgramming 2 года назад
Thanks a lot Sudhakar! Really appreciate that 😊
@seb.z.g
@seb.z.g Год назад
Thank you!
@thefudge
@thefudge 11 месяцев назад
Nice vid! Would you happen to have a full tutorial for javascript?
@MaxProgramming
@MaxProgramming 11 месяцев назад
I didn't make a full tutorial on JavaScript as there are plenty of good ones already. The one I'll recommend is by @TheNetNinja
@thefudge
@thefudge 11 месяцев назад
@@MaxProgramming I see, because I really like how you explain things.
@MaxProgramming
@MaxProgramming 11 месяцев назад
@@thefudge Thanks 😁 I hope the tutorial I mentioned helps
@lindblomdev
@lindblomdev Год назад
I didn't know you could double click the empty space in the file drawer of vscode to get a new file. This will save me some time. Thanks 👍
@MaxProgramming
@MaxProgramming Год назад
Glad it helped Chris ✌️
@pcdxle7349
@pcdxle7349 Год назад
Hey Man! Thanks for this tutorial, keep it up. All of your videos are well detailed.
@awesome4159
@awesome4159 3 года назад
Thanks this video is very helpful for me
@thethinhobbies9263
@thethinhobbies9263 Год назад
Very good job, please keep going
@_jawad_3090
@_jawad_3090 2 года назад
for me getitem is not storing the data on screen after refresh even after parsing the array
@MaxProgramming
@MaxProgramming 2 года назад
getItem does not store the data. It GETS the data. setItem SETS the data. Can you send your code and elaborate it more?
@_jawad_3090
@_jawad_3090 2 года назад
@@MaxProgramming let shop = document.getElementById('shop'); let basket = JSON.parse(localStorage.getItem("data")) || []; let items = [ { id: "1", name: "cloths", price: "140", img: "products (1).jpg", stars:"4", }, { id: "2", name: "cloths", price: "199", img: "products (2).jpg", stars:"5", }, { id: "3", name: "cloths", price: "155", img: "products (3).jpg", stars:"5", }, { id: "4", name: "cloths", price: "140", img: "products (4).jpg", stars:"4", }, ]; let generateShop = () => { return (shop.innerHTML = items.map((i) => { let {id, name, price, img} = i; let search = basket.find((x) => x.id === id); return ` ${name} $${price} ${search.item === undefined? 0 : search.item} Rating : `; }).join('')); }; generateShop(); let increment = (id) => { let search = basket.find((x) => x.id === id); if(search === undefined) { basket.push({ id, item : 1, }); } else { search.item += 1; } localStorage.setItem("data", JSON.stringify(basket)); update(id); }; let decrement = (id) => { let search = basket.find((x) => x.id === id); if(search.item === 0) return; else { search.item -= 1; } localStorage.setItem("data", JSON.stringify(basket)); update(id); }; let update = (id) => { let search = basket.find((x) => x.id === id); document.getElementById(id).innerHTML = search.item; calculation(); };
@MaxProgramming
@MaxProgramming 2 года назад
@@_jawad_3090 Contact me on Discord discord.com/users/691360911440609290
@usamabhatti4109
@usamabhatti4109 2 года назад
Salam bhai, Lg to Paki rahy ho.
@MaxProgramming
@MaxProgramming 2 года назад
W. Salam bhai. I am Indian 🙂
@arushigupta1864
@arushigupta1864 3 года назад
thank you so much...you have no idea how much this video helped me
@NazrulIslam-tt6gj
@NazrulIslam-tt6gj 2 года назад
thanks bro really very helpfull.
@simasgradeckas4259
@simasgradeckas4259 2 года назад
Thanks for the video! This is probably the best tutorial on localStorage out there. Quick question: how would you delete specific students from the students key-value pair (since it is an array of objects)? It's simple to remove a specific key-value pair (removeItem) or the whole localStorage (clear) but I'm having issues removing specific parts within a specific value. Would really appreciate the help!
@MaxProgramming
@MaxProgramming 2 года назад
Good question! It would have been better if I had included it in the video but here is the way you can do it. 1. Use getItem to get the students array and store it in a variable 2. Use the Array Filter method to filter out the "students" array and remove one specific student from it (this blogpost will help you understand array filter method: jamesqquick.hashnode.dev/javascript-array-filter-method-practice-in-5-minutes ) 3. Once you have modified the array "students" using the filter method on it, save the modified array in localstorage using the setItem method. Let me know if you were able to implementt this deletion feature ✌
@simasgradeckas4259
@simasgradeckas4259 2 года назад
@@MaxProgramming thank you so much! This worked wonders :) Appreciate it!!
@davidballowe5546
@davidballowe5546 2 года назад
exactly what I was looking for thank you
@anjalichauhan5169
@anjalichauhan5169 2 года назад
hey 20:01 getting TypeError Cannot set properties of null (setting 'onsubmit')
@MaxProgramming
@MaxProgramming 2 года назад
Can you show your code?
@Doug-nc2ov
@Doug-nc2ov 2 года назад
Hi there, just a quick question regarding the use of checkboxes in the form I set everything up as shown in the tutorial with the use of different types of input fields including normal text fields as well as checkboxes and sliders. I keep getting the error message when clicking my submit button "TypeError: Cannot read properties of null (reading 'checked')" regarding my checkboxes. Would you have a suggestion to fix this issue and to properly implement checkboxes? Many thanks!
@MaxProgramming
@MaxProgramming 2 года назад
Did you add the proper name attribute to the checkbox and also the same while selecting it in JavaScript. This happens if the checkbox is not selected properly and that makes it null
@Doug-nc2ov
@Doug-nc2ov 2 года назад
@@MaxProgramming Thank you for your extremely quick response, i will have a look at my code now and make changes!
@Doug-nc2ov
@Doug-nc2ov 2 года назад
@@MaxProgramming The names match up in the "DOM Elements" section of code as well as everywhere else, so i have no idea what is going on
@Doug-nc2ov
@Doug-nc2ov 2 года назад
@@MaxProgramming Would i be able to add you on discord to discuss this issue further? If not, dont worry as i understand that you are most likely busy.
@MaxProgramming
@MaxProgramming 2 года назад
@@Doug-nc2ov Sure! I am busy right now. Drop me a message Usman#7291
@hussaingagan9196
@hussaingagan9196 Год назад
Very well explained usman 👍
@runewilbur728
@runewilbur728 2 года назад
This helped me a lot and introduced some new things to explore. One thing I'm not clear about. When I run "typeof students" it says students is an 'object'. Yet we're using push( ) to add new students. Isn't push( ) is an array function? How is this working?
@MaxProgramming
@MaxProgramming 2 года назад
Thanks for the comment Rune! Actually arrays in JavaScript are also a type of objects in the end. If you want to check if some variable is an array, you can use this way instead of using the typeof operator. *data instanceof Array;* OR *Array.isArray(data);*
@salesforceWithParamita
@salesforceWithParamita 2 года назад
Excellent demo . Thanks
@Rahul-ur6xz
@Rahul-ur6xz Год назад
Really Nice Tutorial
@aerosnow7707
@aerosnow7707 Год назад
WOW! You explained it very well and covered all the important concepts. This will help me with my project!
@MaxProgramming
@MaxProgramming Год назад
That is awesome! Good luck for your project!
@target500milliontradersinv5
@target500milliontradersinv5 7 месяцев назад
Super vedio
@oscarenbacka_4909
@oscarenbacka_4909 Год назад
Proud of you young man!
@Ninjaphil24
@Ninjaphil24 2 года назад
Answered all the questions I had and many I didn't even know I had!!
@MaxProgramming
@MaxProgramming 2 года назад
Happy to know that Philip 😄!
@neelimaneelu195
@neelimaneelu195 2 года назад
great work buddy
@kaycee5243
@kaycee5243 Год назад
Super helpful!
@amanashra1607
@amanashra1607 2 года назад
amazing bro ..this vedio was awesome. now i get the concept of local storage this vedio deserve to be more likes and share .
@MaxProgramming
@MaxProgramming 2 года назад
Thank you so much for the kind words Aman 🙂!
@amanashra1607
@amanashra1607 2 года назад
@@MaxProgramming can you give me personal guidance bro ..like how i can also be that much logistic and be prepared for the interviews
@rangabharath4253
@rangabharath4253 3 года назад
Awesome as always 👍😀
@mikaelfarro
@mikaelfarro 2 года назад
Thanks man!
@barcelonafan
@barcelonafan 2 года назад
can you make a video on how to delete and edit student?
@MaxProgramming
@MaxProgramming 2 года назад
Sure! I'll make a separate video on that in a few days. Stay tuned!
@ThePrryns
@ThePrryns 2 года назад
Hi there, is there a way to add Admin (who can create, edit, delete and add) and Users (who can only create, edit, and view). I don't know how to implement the admin rights and user rights to this type of project. This tut is the easiest that I can understand as I just started learning. Do you know how to add specific user/admin roles and permissions to the project you've created in this video? Please, any help would be great. Thanks!
@MaxProgramming
@MaxProgramming 2 года назад
Yes it is technically possible but it's a bad practice. Usually in this case you must have a back-end and a database system. Where you can add user accounts and roles etc. Anyone can open the devtools and change items in local storage. If we want to add roles in this case, you can store the ROLE in localstorage and then add an IF condition to check if the role is NORMAL and ADMIN.
@ThePrryns
@ThePrryns 2 года назад
@@MaxProgramming you're very right but my lecturer asked us (beginners) to create it with 1 admin and 4 users. For the solution you gave. Which part of the code do I implement it. Tbh I just learned about localstorage earlier today. It's a bit confusing.
@MaxProgramming
@MaxProgramming 2 года назад
@@ThePrryns okay lemme explain Localstorage is just like an object, and it can contain data that will be available on refresh too. Now in this case, what you can do is you can also add another item in localstorage with "setItem". For the "userRole" as a STRING. That can be either admin or normal.. Then you can "getItem" the "userRole" from localstorage, and you can check if it is equal to "admin" or "normal". Then you can allow the action or not based on that value I don't know what exact problem statement of yours is. But try to figure it out on your own. It might be a fun, challenging exercise and it will require a lot of googling. So don't hesitate to google stuff
@ThePrryns
@ThePrryns 2 года назад
@@MaxProgramming oh my thank you much. I understand what you mean. I'm going to work on my code tmr morning. This means a lot, thank you 🙏🏽 ☺️ 👍🏽
@thomasmpiana513
@thomasmpiana513 2 года назад
hey how can I put the output result to another page
@MaxProgramming
@MaxProgramming 2 года назад
EDIT: You can do so. Just add a JavaScript file and get data from localstorage
@rpralica
@rpralica Год назад
I've seen a lot of tutorials like this about localStorage, but this one is definitely the best. You deserve likes and subscribes. Thank you very much.
@MaxProgramming
@MaxProgramming Год назад
Really appreciate that Rade! I'm glad you found this as the best one 🙂
@rpralica
@rpralica Год назад
@@MaxProgramming I would be grateful if you would make a similar video but crud local storage with a table.
@MaxProgramming
@MaxProgramming Год назад
@@rpralica Yes I just started tutorial series of a CRUD app with local storage. Only difference is that it doesn't have table ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-vPy-32qDCK4.html
@arushigupta1864
@arushigupta1864 3 года назад
how can we input a vehicle license plate no. ???
@MaxProgramming
@MaxProgramming 3 года назад
There is no template for plate numbers in HTML. However if you want to validate accordingly you can use JavaScript with regular expressions or you can use the pattern attribute. More on that here: stackoverflow.com/questions/37611180/html5-input-pattern-for-french-licence-plate-number
@digitaltanzeel1056
@digitaltanzeel1056 2 года назад
if i have already Dom then how we get item and show in user interface
@MaxProgramming
@MaxProgramming 2 года назад
What do you mean by "if we already have Dom"? Can you please elaborate?
@digitaltanzeel1056
@digitaltanzeel1056 2 года назад
Can you give me you telegram I'd so, that I can show where I am stuck
@MaxProgramming
@MaxProgramming 2 года назад
@@digitaltanzeel1056 Reach me out on Discord Usman#7291
@suryatejaparvata
@suryatejaparvata 2 года назад
simple and clear.
@MaxProgramming
@MaxProgramming 2 года назад
Good to know 😃
@kaushikbora2728
@kaushikbora2728 8 месяцев назад
1:26 key palue vairs🥸
@MaxProgramming
@MaxProgramming 8 месяцев назад
haha good catch 🤣
@sanjanabhat5032
@sanjanabhat5032 Год назад
studentsContainer.style.display = students.length === 0 ? "none" : "flex"; is this line really required? since the div is empty it won't display anyway right, or is it the fact that even though it's empty, it's still there and we don't want it to be there at all?
@MaxProgramming
@MaxProgramming Год назад
Because of the styles we have added to the studentsContainer, the background colour is visible if the EMPTY DIV is visible. Hence we set the display to none so that nothing shows up
@sanjanabhat5032
@sanjanabhat5032 Год назад
@@MaxProgramming oh, so there's a default width and height for the div even though it's empty?
@sanjanabhat5032
@sanjanabhat5032 Год назад
I set a background color and it didn't appear 🤔 without using the ternary you mentioned
@MaxProgramming
@MaxProgramming Год назад
@@sanjanabhat5032 I haven't inspected the div in that moment but I don't think there is width and height. (Padding might be affecting the issue) Once some content gets added, and it's removed, then it seems like the div still gets displayed P S. Let me know if you've got a better solution...
@MaxProgramming
@MaxProgramming Год назад
@@sanjanabhat5032 Then I think you should go with what floats your boat. If it works without the background colour and you want to keep it that way, no problem.
Далее
Local Storage Explained In 10 min | Javascript
10:53
Просмотров 61 тыс.
Local Storage for Beginners | JavaScript Tutorial
15:39
Обменялись песнями с POLI
00:18
Просмотров 286 тыс.
When Goalkeepers Get Bored 🤯 #3
00:27
Просмотров 1,5 млн
LocalStorage for beginners (HTML and Javascript)
12:27
How to Use Local Storage in JavaScript
15:23
Просмотров 284 тыс.
Saving User Input in JS Objects
8:00
Просмотров 201 тыс.
Урок 17. JavaScript. Все о LocalStorage
16:39
Просмотров 152 тыс.
5 JavaScript Concepts You HAVE TO KNOW
9:38
Просмотров 1,4 млн
JS - How to STORE and USE an Array in Local Storage
8:25
Обменялись песнями с POLI
00:18
Просмотров 286 тыс.