PageSourceSearch

https://full-time.learnhowtoprogram.com/assets/js/6b76a7e0.335f13bf.js

js learnhowtoprogram.com collected 2026-09-24 21:16:33 UTC 7,657 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunklhtp=self.webpackChunklhtp||[]).push([[1962],{30876:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>w});var i=n(2784);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),s=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=s(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=s(n),u=r,w=d["".concat(l,".").concat(u)]||d[u]||m[u]||o;return n?i.createElement(w,a(a({ref:t},p),{},{components:n})):i.createElement(w,a({ref:t},p))}));function w(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=u;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[d]="string"==typeof e?e:r,a[1]=c;for(var s=2;s<o;s++)a[s]=n[s];return i.createElement.apply(null,a)}return i.createElement.apply(null,n)}u.displayName="MDXCreateElement"},57464:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>m,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var i=n(7896),r=(n(2784),n(30876));const o={title:"\u270f\ufe0f Practice: Interactivity with Window Methods",id:"practice-interactivity-with-window-methods",slug:"practice-interactivity-with-window-methods",hide_table_of_contents:!0,sidebar_position:35,day:"monday",type:"exercise",url:"https://github.com/epicodus-curriculum/intro-full-stack/blob/main/1k_classwork_practice_interactivity_with_window_methods.md"},a=void 0,c={unversionedId:"introduction-to-programming/javascript-and-web-browsers/practice-interactivity-with-window-methods",id:"introduction-to-programming/javascript-and-web-browsers/practice-interactivity-with-window-methods",title:"\u270f\ufe0f Practice: Interactivity with Window Methods",description:"Goal",source:"@site/docs/introduction-to-programming/2_javascript-and-web-browsers/1k-classwork-practice-interactivity-with-window-methods.md",sourceDirName:"introduction-to-programming/2_javascript-and-web-browsers",slug:"/introduction-to-programming/javascript-and-web-browsers/practice-interactivity-with-window-methods",permalink:"/introduction-to-programming/javascript-and-web-browsers/practice-interactivity-with-window-methods",draft:!1,tags:[],version:"current",sidebarPosition:35,frontMatter:{title:"\u270f\ufe0f Practice: Interactivity with Window Methods",id:"practice-interactivity-with-window-methods",slug:"practice-interactivity-with-window-methods",hide_table_of_contents:!0,sidebar_position:35,day:"monday",type:"exercise",url:"https://github.com/epicodus-curriculum/intro-full-stack/blob/main/1k_classwork_practice_interactivity_with_window_methods.md"},sidebar:"introduction-to-programming",previous:{title:"\ud83d\udcd3 A Common Data Type Error and Data Type Coercion",permalink:"/introduction-to-programming/javascript-and-web-browsers/a-common-data-type-error-and-data-type-coercion"},next:{title:"\ud83d\udcd3 Adding JS to a Project",permalink:"/introduction-to-programming/javascript-and-web-browsers/adding-js-to-a-project"}},l={},s=[{value:"Warm Up",id:"warm-up",level:2}
1,{value:"Code",id:"code",level:2},{value:"<code>window</code> Methods Practice",id:"window-methods-practice",level:3}],p={toc:s},d="wrapper";function m(e){let{components:t,...n}=e;return(0,r.kt)(d,(0,i.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Goal:"),'  In the "Interactivity with Window Methods" lesson, we learned:'),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"window")," methods perform actions in the browser."),(0,r.kt)("li",{parentName:"ul"},"Examples of ",(0,r.kt)("inlineCode",{parentName:"li"},"window")," methods include ",(0,r.kt)("inlineCode",{parentName:"li"},"window.alert()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"window.prompt()"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"window.confirm()"),"."),(0,r.kt)("li",{parentName:"ul"},"JavaScript methods can be chained onto ",(0,r.kt)("inlineCode",{parentName:"li"},"window")," methods.")),(0,r.kt)("p",null,"Methods are an important part of programming, and you'll be using them constantly. Get the hang of calling ",(0,r.kt)("inlineCode",{parentName:"p"},"window")," methods by completing the practice exercises listed below."),(0,r.kt)("h2",{id:"warm-up"},"Warm Up"),(0,r.kt)("hr",null),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"How can we comment out code?"),(0,r.kt)("li",{parentName:"ul"},"What happens when we run code that is commented out?"),(0,r.kt)("li",{parentName:"ul"},"What are the differences between the ",(0,r.kt)("inlineCode",{parentName:"li"},"window.alert()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"window.confirm()"),", and ",(0,r.kt)("inlineCode",{parentName:"li"},"window.prompt()")," methods?"),(0,r.kt)("li",{parentName:"ul"},"What is data type coercion?")),(0,r.kt)("h2",{id:"code"},"Code"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"window-methods-practice"},(0,r.kt)("inlineCode",{parentName:"h3"},"window")," Methods Practice"),(0,r.kt)("p",null,"Practice using these ",(0,r.kt)("inlineCode",{parentName:"p"},"window")," methods:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Use ",(0,r.kt)("inlineCode",{parentName:"li"},"window.alert()")," to pop up a dialog box with a warning for the user."),(0,r.kt)("li",{parentName:"ul"},"Use ",(0,r.kt)("inlineCode",{parentName:"li"},"window.confirm()")," to ask a yes or no question."),(0,r.kt)("li",{parentName:"ul"},"Use ",(0,r.kt)("inlineCode",{parentName:"li"},"window.prompt()")," to ask a question."),(0,r.kt)("li",{parentName:"ul"},"Save the response to the ",(0,r.kt)("inlineCode",{parentName:"li"},"window.prompt()")," as a variable. All responses entered by a user into a prompt input are saved as strings (even if the user enters ",(0,r.kt)("inlineCode",{parentName:"li"},"10"),", the value is saved as the string, ",(0,r.kt)("inlineCode",{parentName:"li"},'"10"'),"). Run at least 3 string methods of your choice on the string variable that you create from the prompt."),(0,r.kt)("li",{parentName:"ul"},"Ask the user to enter their age in a prompt, and turn the response into a number using ",(0,r.kt)("inlineCode",{parentName:"li"},"parseInt()"),". First, save the response as a new variable and turn it into a number. Then, try turning the response into a number without saving it into a variable.")))}m.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.