Skip to main content

Posts

Showing posts with the label javascript

Loop is javascript

 references https://www.decodingweb.dev/fix-map-is-not-a-function-error-in-javascript#:~:text=Whenever%20you%20encounter%20a%20%22map,log(data)%20.&text=Before%20making%20any%20change%20to,need%20an%20array%20inside%20it! https://dev.to/ramonak/javascript-how-to-access-the-return-value-of-a-promise-object-1bck https://bobbyhadz.com/blog/javascript-map-is-not-a-function

Javascript concepts

Q1:  What is hoisting ? Variables and methods are hoisted in js which mean their declaration goes on top of the code mean when you console.log the value of variable before it initialize with any data ,it show its undefined value. var a; console.log(a) //undefine a = 12; console.log(a) // 12 console.log(b) // you will get an error b is not defind. Q3:What are data-types ? There are to type of data in js 1 ) primitive number, string, boolean, null, undefined are primitive data types.   2) References References => (), [], {} Definition in urdu: Asi koe bhi value jisko copy krne pr real copy nhi hota. Blke os mein value ka reference pass ho jata hai, ose hum reference value bolte hain. Or jiska copy krne pr real copy ho jae wo primtive value hoti hai. Let say we have an array let a = [1,2,3]; let b = a; when you pop value from array 'a' than the value also not exist in array 'b' bcz 'b' are taking/using/having array/data of array 'a' a.pop(); console.log(...

History Objects in Javascript

  < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > History Object </ title > </ head > < body >     < button onclick = " back () " > Back </ button >     < button onclick = " forward () " > Forward </ button >     < a href = "https://www.youtube.com" > youtube </ a >     < br >     < p > Go back and forth with go method! </ p >     < button onclick = " back () " > Go Back </ button >     < button onclick = " forward () " > Go Forward </ button > < script >     console . log ( history );     // number of page in history     console...

Location Objects in Javascript

  < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > BOM Location Object </ title > </ head > < body >     < h1 > Location Object </ h1 >     < button onclick = " google () " > Google </ button >     < button onclick = " reload () " > Reload </ button >     < button onclick = " assign () " > Assign </ button >     < button onclick = " replace () " > Replace </ button >     < p id = "demo" ></ p >     < script >         let origin = window . location . origin ;         document . getElementById ( 'demo' ). innerHTML = origin ;...

BOM window Objects in javascript

  < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > BOM Window Objects </ title >     </ head > < body >     < h1 > BOM Window Objects </ h1 >     < button onclick = " openWindow () " > Open Window </ button >     < button onclick = " resizeToWindow () " > Resize To Window </ button >     < button onclick = " resizeByWindow () " > Resize By Window </ button >     < button onclick = " closeWindow () " > Close Window </ button >     < script >         var mywindow ;         function openWindow (){             m...

DOM setTimeout and clearTimeout Methods in javascript (One Time Animation).

  < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > One time Animation </ title >     < style >         .box {             width : 200px ;             height : 200px ;             background-color : cornflowerblue ;         }     </ style > </ head > < body >     < h1 > One Time Animation </ h1 >     < h2 > setTimeout() and clearTimeout() Methods </ h2 >     < p > if you want to perform any animation or any operation and perticular or after      perticular time, according to your ne...