2 projects with Async JS | chai aur
HTML-код
- Опубликовано: 5 окт 2024
- Visit chaicode.com for all related materials, community help, source code etc.
#javascript #hindi
Sara code yaha milta h
github.com/hit...
Discord pe yaha paaye jaate h:
hitesh.ai/discord
Instagram pe yaha paaye jaate h:
/ hiteshchoudharyofficial
cheeze itni easy hoti nahi jitni easy aap bana dete ho sir, I wish I found you during my clg time, but nevertheless I know u are here always to help us. Thanks you so much.
Solution for task 1 at 16:38
const saydate = function(str){
console.log(str , Date.now())
}
let Interval;
document.querySelector("#start")
.addEventListener('click', function(){
Interval = setInterval (saydate, 1000, 'Anything')
} )
document.querySelector("#stop")
.addEventListener ("click", function(){
clearInterval (Interval)
})
I'm extremely grateful to this channel! This is the most in depth tutorial for JS I've ever found!
ek problem hai isme agar start par dooble click kare to fir vo stop nahi hoga
@@DharmpalSinghSisodiya-zh1df I reran it and what u said is true, but I can't seem to understand what's causing this. I'm sorry for this, if u know the reason , do tell me! thnx for pointing it out.
Thanks buddy
@@ashishbisht6857 np ;)
3:28 setTimeour( )
10:02 clearTimeour()
13:40 setInterval()
15:46 clearInerval()
17:05 project 6 (Background Color Changer)
32:02 project 5 (keyboard checker)
( : ye lo Bhai Ji : )
thanks brother
Bhai app jug jug jio
Thanks alot!
Hardly any tutor taught clearTimeout() in their tutorials. Kahan the aap Hitesh ji itne time se. You're a blessing in disguise. ❤
Thank you sir❤
Pahle chai bna leta hu fir chai ke saath video dekhunga 😅
😂
😂
phele pc on kar lo, pir vs code..
Chai coro.. Vo hitish sir pee lega.. Sirji ka time bara accha caal raha haun 😂
SetTimeout(function/function reference,milliseconds)
ClearTimeout(variable which hold the reference of settimeout)
SetInterval(function /functiom reference, milisecond) - repeat until we clear it.
ClearInterval(reverence of function)
Task 16:30
My solution
const stInt = function(str){
console.log(str, Date.now());
}
let interVal;
document.querySelector('#start').addEventListener('click',function(){
interValid = setInterval(stInt, 1000, 'Hello World');
})
document.querySelector('#stop').addEventListener('click', function(){
clearInterval(interValid);
console.log('clicked');
})
23:29 you guys can also use this for random colors
//GET RGBA FOR BACKGROUND COLOR STRING
function getRGBA() {
let random1 = Math.floor(Math.random() * 255);
let random2 = Math.floor(Math.random() * 255);
let random3 = Math.floor(Math.random() * 255);
return `rgba(${random1},${random2},${random3})`;
}
thankyou
function randomColor () {
let color = "";
for (let i = 0; i < 3; i++) {
color += ` ${Math.floor(Math.random() * 256)}`
}
return body.style.backgroundColor = `rgb(${color})`
}
mai bhi yeh soch rha thaa krne ko @@Abbas_404
I also used rgba;
function random(num){
return Math.floor(Math.random()*(num+1));
}
let changeColor;
document.getElementById('start').addEventListener('click', () => {
changeColor = setInterval(()=>{
let colorCode = `rgb(${random(255)}, ${random(255)}, ${random(255)})`;
document.body.style.backgroundColor = colorCode;
}, 1000)
})
Great content Hitesh, I hope more and more people find this amazing channel where you make things so easy to understand. When I was working on an app (MERN - Chat Application) I found these topics tricky because just a keyword await had so much power that it was not encrypting the passwords I was sending to the DB. After hours of debugging, it made me realize that I need to learn such topics first to be able to build such application. But what good way to learn than a project. Anyhow! I am glad that we have people like you in tech helping us in our journey.
Sir 3din phle start kiya JavaScript apke channel pe aur lgbhag aadha Video dekh liya practical bhut acha smjhaye apne 🥰
31:20
We are checking intervalId is not null then only start the interval otherwise it would create the multiple instances of the setInterval which would change the background color much faster and the stop button would not be able to clear all intervals if initially we have clicked on start button multiple times and then we click on stop button.
He didn't properly explained the reason why it was not working as you mentioned. it would be much better if he would have said, we are setting interval to none to save memory space and checking intervalID for the problem you mentioned in your comment. He made it look like the stop was not working because we set intervalID to null, while the actual reason of why it was not working was reason you mentioned.
Ek esa yt channel jo javascript ka series pura vistrit rup se patha rahe hai. Aapko iske lie bahut bahut dhanyawad ❤❤😊
Is series se competition paid courses b nhi kr payenge
@@chaiaurcodeyour theme font name ?
@@chaiaurcode belkul Sir no doubt
First of all I want to mention that the course is fire. So far, among all the courses I have taken this one has more in-depth concepts and I am really happy to find out that such free course exits. I would request Hitesh Sir to bring more courses like this in the future.
Sir i love the way of ur teaching.... I literallyy amazed after seeing ur video... I learned the enhanced perspective of learning of web development... Please sir made video fast
So nice of you, jldi hi laate h
I can tell my two months journey into full stack. I found it daunting to master backend. I switched to firebase. Next i started small projects in JS but i had to throw it all away once i started building a task management website using react. Its completely different, doing small projects and building something you want to according to your vision. There are ao many things involved. I didn't even do any react hooks individually but i am implementing and trying to understand them in the website. Its daunting, challenging.
hey i would like to connect eith you. your discoed please!
" ek thread pr chalta isliye, javascript hai" gave me goosebumps
love the way you teach !!!
love your clean way writing code
one of the best channel for learning out standing i love it... big love big respect for you sir from pakistan.
Task One
Chai Or Javascript
start
stop
const date = function(){
console.log("waleed", Date.now());
}
document.querySelector('#start').addEventListener('click', function(){
const intervaled = setInterval(date ,1000);
console.log("Start");
document.querySelector('#stop').addEventListener('click', function () {
clearInterval(intervaled);
console.log("Stop");
})})
I think the 'Stop' button not 'seemingly' working at 29:10 is not because of indexId value being changed from null to the reference of setInterval() but because of that prior to clicking the 'Stop' button, the 'Start' button was clicked multiple times hence multiple setInterval() methods are running simultaneously. The indexId has the reference of only the last setInterval() and the references of the previously started intervals have been lost. Clicking on 'Stop' clears that process but the other prior started setIntervals continue to run hence it appears that 'Stop' did not work at all. The check if(!intervalId) ensures that if an interval is already executing, another interval should not start. Great series overall! Enjoyed watching and doing the projects myself alongside
yes , brother you are right
Sir ji app to bol dete hai ki share kro but ye itna precious resource hai ki agr share kiya to hume hi nuksaan hai , competition aur jyaada bdh jaaega. Ye to khud k pair pr hi kulhaadi marne wali baat ho jaaegi 😇. Correct me if I am wrong
29:13 i run the same exact code but mine one is stopping even after starting and stopping again and again
wonderful lecture , very depth analysis , always asked in interviews these types of questions. one of the best lecture.
sir why have you used in project 5
16:30
Task-1
let interval_Variable;
let myDate = new Date();
document.querySelector('#start').addEventListener('click',()=>
{
interval_Variable= setInterval(function(){
console.log('Hello Shubh', myDate.toLocaleString());
},10000)
})
document.querySelector('#stop').addEventListener('click',()=>
{
clearInterval( interval_Variable);
console.log('stopped');
})
Hey Shubhanshu, I have an issue like the code I have posted below this reply, in that my code is running without error and my start and stop buttons are working but when I click the stop button clearInterval doesn't works. i want to know why ?
Interval Example
Kartikey
Start
Stop
let k;
let fStart = function() {
console.log("Kartikey");
}
const ks = function() {
k = setInterval(fStart, 2000);
}
let s = function() {
clearInterval(k);
}
document.querySelector('#start').addEventListener('click', ks);
document.querySelector('#stop').addEventListener('click', s);
Love to listen your Hindi 😄, And Always exited to learn something new from your videos keep uploading ..
Thank you Hitesh for making JS so simple for me.
i have tried to create a greeting project using setInteval() below: Just wounding how's my coding structure looks like?
Events
Greet
Start Greeting
Stop Greeting
let greet ;
//start:
function startGreet(){
greet = setInterval(function(a){
document.querySelector('#line').innerText = `${a} at ${Date.now()}`;
}, 1000, 'Namaste'); // the third is the function parameter.
}
// Stop:
function stopGreet(){
clearInterval(greet);
document.querySelector('#line').innerText = 'Greet Stopped!';
// console.log(greet);
}
document.querySelector('#start').addEventListener('click', startGreet);
document.querySelector('#stop').addEventListener('click', stopGreet);
🔥🔥🔥🔥🔥🔥 content will smash whole youtube
Jabse apka series start kya js ka avi tak ka class bht easy lagne laga hai. U are awesome sir. 🎉🎉🎉🎉🎉.
3:28 setTimeour( )
10:02 clearTimeour()
13:40 setInterval()
15:46 clearInerval()
17:05 project 6 (Background Color Changer)
32:02 project 5 (keyboard checker)
Awsome project on ( setTimeout and setInterval ) Never seen such interesting lecture with such indepth project.
thank you so much for this playlist, I tried learning JS during btech, but didn't like it much. Now I am loving it
my man just gave away deep knowledge for free so that everyone can learn from it ..... hats off
Goat of web development is back 🐐
Best series ever. Thanks a ton again
this series is really underrated
behtareen behtareen behtareen behtareen behtareen behtareen behtareen
Love you sir. Regret that RUclips didn't recommend this channel long ago. Thanks you for the playlist sir!
Namaste Guruji,
Thanks for your valuable knowledge and time..
Sir your teaching skill is amazing
sbse best channel hai sir aapka
Sir , your teachingstyle are simplier and are just full of experience , i am understanding javascript now very well thank you so much sir
the random color generator code was awesome
thank you sir , bina dekhe project 6 main ne banaya ,aap ne jitna samjaya us ki help se.phali bar khud me confidence aarha hai because of you sir ,again thank you so much
Sir Hitesh is a wonderful experienced person.... If you want to be a developer then listen to sir Hitesh lectures ❤
6:13 "kaafi der h"
I didn't realise that until I did it myself
Thank You sir🙏🙏
sir appne isme jo random color ke liye function likha tha woh maine first project mein bhi add kara tha khud se loop lga kar jisse hash ke random number se color lene ke liye. And you also add that same here. I never have this kind of feeling before. mujhe toh lga tha js muskil hai but yeh toh bhot assan banadi aapne . Thanks Sir
💌💌💌💌💌
best free javascript resource on youtube
Best real teacher on RUclips
The way u explain is fabolous , i dont think there are any other RUclipsr related to programming who can even reach half of ur level on quality and explanation
We need more teachers like you ❤ .
cheeze itni easy hoti nahi jitni easy aap bana dete ho sir, I wish I found you during my clg time, but nevertheless, I know u are here always to help us. Thanks you so much. (2)
Hats off to you sir, I don't know how you make such hard topics this much easy. Wondering that how lucky would be those people who personally train under you in the company, so many like me are dreaming of to happen with us. Thank you so much for this precious knowledge.
12:44 enjoying the series a lot 💖
East or west , Hitesh Sir is the best
One of the best series he sir, mene jitani bhi js sikhi he aapse hee sikhi hain, ekdm fresher aaya tha me, aap aapka work kabhi roko mat ❤❤❤
Atleast koi toh he joh sochta he ki bhale students ke paas paise nahi he, phir bhi me padaunga, aapka ye motivation bohot sahi he. Kahi bhi other videos me jaao baki chize bohot hoti he bht aap baki baaten bhi JS ko context me leke karte ho ❤❤❤❤
"Chai aur Code, your teaching style is a breath of fresh air. Thanks for making JavaScript a joy to learn!"
sir i did the start and stop assignment, thank you
Please continue this series because it helps lot me
Iss se behtar course lane main kisi ko 100 saal lag jayega, 😊 sayad uss se bhi jyada
Just fabulous😊 course
Real 0 to mastery playlist for javascript ❤
16:50
const sayDate = function(str){
console.log(str, Date.now());
}
const toStart = function(){
intervalId = setInterval(sayDate, 1000, "hi");
}
const toStop = function(){
clearInterval(intervalId);
}
document.querySelector('#start').addEventListener('click', toStart);
document.querySelector('#stop').addEventListener('click', toStop);
You declear intervalid in toStart block then how can you access it on toStop block?
right how is it possible?
Best JS Series in the world
you are amazing sir, respect for you from bottom of my heart, one of your student from pakitsan
Sir you are osm mene pehle bhi apki series' follow ki thi but thoda beginner tha to. Adhe raste Mai aakr me thoda smjh nhi paya tha but ab apke har ek project mene khud se bhi kiye hai help of you 😅 apka jo tarika h js pdhane ka voh kafi sahi h kafi jaldhi apne js ke fundamental and imp topics cover karwa diye thnk you so much sir ji mai apko LinkedIn par tag bhi krunga apse sikhe kuch project ko thoda aur change and kuch functionality aur add kr ke 😅
hi( Great content Hitesh, I hope more and more people find this amazing channel where you make things so easy to understand. When I was working on an app (MERN - Chat Application) I found these topics tricky because just a keyword await had so much power that it was not encrypting the passwords I was sending to the DB. After hours of debugging, it made me realize that I need to .....
cheeze itni easy hoti nahi jitni easy aap bana dete ho sir, I wish I found you during my clg time, but nevertheless I know u are here always to help us. Thanks you so much.)
Sir, in the unlimited colors project i tried a very weird case where i clicked start button again after clicking the start button and after that the setinterval time increased and the color started to change very quickly and also the stop button "stopped" working. So i did a hack by disabling the start button after clicking once and enabling the button after stopping. I love your videos sir ❤. And also my by watching your videos my mind started to think about every type of user scenario. Thank you so much sir :)
hey i would like to connect eith you. your discoed please!
@@tajinder715username:- vedantpanchal
I am learning before your channel but now watch only your video is very perfectly thank you so much for beginners sir 😊
Aslam o Alaikum.... your course is wonderful and *Allah* give you a long and healthy life
no need ,Supreme God bless him,Jai Mahakal
Yaha pe Allah kaha se aagye bhai.. ?? pdho gyan lo ar niklo, bakchodi krna jruri hai?
18:18 sir thoda time laga but Maine khud se banaya ye project tumne suruvat se bola tha khud se kuch to banahi loge ye js se and I got it ❤❤
Thank you so much sir dobara video shoot karne ke liye
Thank you so much for your lots of efforts
thanks dubara video record krne k liye yeh js ka student apko thanks khta hai like the video also subscribe toh phle se hai !!!!!
This is the best series
you are very good teacher
Thank You sir for this absolutely great course
no one i repeat no one including the paid javaScript courses can teach you like Hitesh sir does ..........i am glad i found the best playlist and followed it to master the greatest language of internet
koi dikkat wali bat hi nhi hai😎😅
Aap jaise guru ka aashirvad mil jaie to kch v asambhav nahi ❤
Sir maine to aap ke banane se pahle hi try Kiya banane ko aur main bana bhi Diya
But aap ka thanks idea ke liye
31:00 this moment is I know exactly what has happened ->
Thik if you click the start button multiple times this will dispatch multiple setInterval functions and now if you click the stop button it has the latest/ last setInterval functions reference so that one will stop but since previous once are still there it will continue execution
best Series ALL OVER The UNIVERSE, thank you Sir 🙏
Hello Hitesh sir .. I was wondering whether we have async/await video in this series. It would be great if we could have that as well. Thank you for making such an awesome series.
Best Async explanation. Best series
Thankyou Hitesh sir, for giving such indepth series, After learning various courses from udemy and yt. I was not confident in js but after watching this series I have confidence that I can build something from my own! Thankyou so much. ❤
hum Java script ko kaise use karte hein website mein kafi time se RUclips per search kar rahe the lekin ab aapke channel mil gaye ab hum achhe se learn kar lenge thankyou so much sir 🎉🎉🎉🎉
16:48 Task DOne 🤘🤘
Thank you sir
sir best teacher ho aap kya padhate ho concepts acche se clear ho raha hai thank you and please make an series on anguler.js if you can.
For generating a random color i have used Rgb format and it is like this
function r(){
let generate = Math.floor((Math.random()*256 +1))
return generate
}
function generateColor(){
let color = `rgb(${r()},${r()},${r()})`
body.style.backgroundColor = color
}
start.addEventListener("click",()=>{
colorChange = setInterval(generateColor,1000)
console.log(colorChange)
})
stop.addEventListener("click",()=>{
clearInterval(colorChange)
})
Great Projects Sir. Really great understanding and deep depth.
Lots of love sir
Toda sa complex zarur he but maza agaya 🥲🔥
Your videos are very very helpful to us. thank you so much sir
Easier way to get hex code:
let color = "#" + Math.floor(Math.random()*(256*256*256)).toString(16)
30:00 setting 𝙞𝙣𝙩𝙚𝙧𝙫𝙖𝙡𝙄𝙙 = 𝙣𝙪𝙡𝙡 is mandatory because if we don't do that and by any chance click start button twice then it will get stuck in infinite loop which can never be stopped (can be stopped by reloading page)
but even if i set intervalId = null, then it still get stuck can only be stopped by reloading page
Fatafat pause Kiya aur share aur like Kiya
BEST CONTENT FOR JAVASCRIPT
awesome, it is the BEST series. even much more better than paid courses.
Allhamdulilah I myself have done assignment ❤ love from Pakistan 🇵🇰 🇵🇰 🇵🇰
Thank you so much sir 😊 sir please make playlist of node js
Great lecture. Thanks alot. I just had a query that if a user just click stop button for the very first time in that case intervalId is not assigned any value yet. So what will be the output in my case it gives undefined. So we need to handle that case too. Please provide your feedback on this. Thanks and wishes you great success ahead.