Simmons University
Class by class Assignments for Chapter 3: JavaScriptComment: In Assignments 0 and 1 we will lean very heavily on your knowledge of Python to get you up to speed on basic JavaScript. A great many of the structures on concepts from CS 112 carry over almost identically. So we will move through that material pretty quickly.Assignment 2 is about some very deep and subtle issues in JavaScript. We will dig through it from different approaches, and you may not understand all of it at once. This will be our first pass at the material. We will return to it in the unit on Advanced JavaScript/ES6.Overview: The assignments covers the following parts of JavaScript – please make sure you see all of them in whatever tutorial series you use, especially for Assignments 0 and 1:Assignment 0 - Introduction to JS ; where it is used; where it goes on your web page Script tags; input and output (prompt, alert, console,log, document.write) Basic data types – numbers, booleans, strings Variables – using var, let and const; scope Comments Basic functions – how to define and call them; passing parameters Objects – notationAssignment 1 Control statements (If etc) Loops Arrays Functions and objects – a deeper look; slight introduction to this and closuresAssignment 2 Constructors, closures, prototypes Use of 'this' Arrow functions Assignment 0 – Chapter 3 Introduction to JavaScript and basic structures This assignment covers the JavaScript detailed above – please make sure you see all of them in whatever tutorial you choose. The javascript programs for this assignment are in Basic_JavaScript_Programs_Part_AA wonderful introduction to our attitude towards writing JavaScript.Please watch the first 11 minutes of Douglas Crockford is one of the great gurus in JavaScript.(Later in the course we may look at the rest of it.) JavaScript is a powerful and very forgiving language. This excerpt will tell you why you want to be careful.Read JSNotes 0This is orient you to JavaScript and make it easy for you to learn quickly from the tutorials.A tutorial in basic JavaScript--- ANY ONE of the following: This is a one hour tutorial by Mosh --- it uses VS Code and covers an introduction to JS, variables, types, objects and simple functions. There is a playlist at Tutorials 1-9 from the newboston. These tutorials are very clear, but older (2011) so you will need to also look at on let and const. This tutorial is from Brad Traversy. A slightly newer version is at This tutorial will take you thru the basics and it uses ES6. up thru the material on Operators. It is an older tutorial so you will need to look at on let and const. If you have already had Data Structures and have some experience with JavaScript , I recommend this tutorial.If you have already had Data Structures and perhaps Computer Lanuaes you might prefer where the material you want is in Chapters 3-5 (skip the Practices). This is a much more sophisticated introduction, but for those of you who have had more courses, it will be less boring. Do Examine the code for doc_write.html and doc_write_revisited.html NOTE: Sometimes when I use ctl-U to examine code I the code is unformatted. You can paste the code into Notepad++ or atom to format it. Modify doc_write.html so that it prints out a short poem or joke and asks the reader if she/he/they liked it. (Use a confirm box.) Examine the miniTable.html page and modify it to add a third row of numbers. Write a script which asks your user for a number and writes out its square. Use a function to compute the square. Write a sentence explaining the difference between alert and confirm.Read JSNotes 1 This will lead you to Where the JavaScript goes (in this folder) , which you should read.Watch VoiceThread1 – Functions and Objects – Part 1 The Word doc parts of this VT may be a little hard to read, but you can find it on the Chapter 3 page.Assignment 1 – Chapter 3 – Variables and Basic FunctionsThe javascript programs for this assignment are in Basic_JavaScript_Programs_Part_A and Part_B.Read Continue in your chosen tutorial from Assignment 0 until you have read about if-then-else statements and loops and arrays and functions.Please notice that in addition to the for and while loops of Python, in JavaScript there is also a do-while loop.Read JSNotes 2 and 3.There is a lot of material in these notes.Watch VoiceThread 2 at Do Examine the version of function1 i(n Part A of the programs folder) which uses an external file for the javascript, and also look at the file holding the script. Modify the script so that script asks for the user’s name and also the user’s age.Modify the script so that the user’s age is converted to a number and your greeting tells the user how old s/he is and will be in 10 years. Modiy this script so that it tells the user how old she/he/they will be in 3, 6, 9, …30 years using a for loop. ("In 3 years you will be ….In 6 years you will be…")Next modify the script so that it gives the user's age every 4 years until the user is at least 66. Use a while or do-while loop. ReadJSNotes 2A - Functions in JavaScript – pages 1-top of 5 (up to start of Crockord's comments. We will come back to the rest later.) and do the exercises in there.. Read: OPTIONAL: Notes on JS from the Stefanov book. This is a short note about good programming style.Assignment 2 – Constructors, prototypes, closures, and 'this' The concept of a constructor function should be familiar to you from writing classes in Python, but there are a few differences between JS and Python, as you will see. In Python you had a 'self' property and you had to name it explicitly in your constructor. In JavaScript 'this' plays the role of 'self', and you get it automatically. On the other hand, 'this' in JS is much more complicated than 'self' in Python. This complexity (and power) is a consequence of important role that functions play in JS. One aspect of that power is the ability of one function to define and return another function, which acheives a 'closure'. Closures are the most powerful and subtle thing you can do in JS. This assignment will be our first introduction to closures, but certainly not our last discussion of them. Read: JSNotes4 (which a review of the previous work) Re-read JSNotes 2A (you may go lightly over section 6 on closures; it’s pretty hairy.) JSNotes5_v3s. Do: Examine the code for CustomObjects1.html, CustomObjects2.html and CustomObjects3.htmlDo the Exercise on Custom ObjectsWrite a short paragraph which explains how an associative array is used to realize an object. In your paragaph you should explain what happens when you add a method or property to an object.What are you doing when you change the sort( ) method of an array?Read: Part 1 of Combined JavaScriptAccording to Douglas Crockford with Further Explanations in Unit 5 – Chapter 9. This is a sophisticated look at the data structures in JavaScript.Part 2 of Combined JavaScriptAccording to Douglas Crockford with Further Explanations in Unit 5 – Chapter 9 through section 6a. This is very sophisticated material and you will need to read it more than once. We will also be coming back to this material in Chapter 9.Do: Email me list of any specific things which you do not understand by 6 p.m. the day before class. Do the exercises in the Part 2 notes you have read. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- spirit 2 ceenbot tekbot site
- course materials umd college of information studies
- maidenhill school amazon web services
- appendix project guidelines national university of
- annex 1 how to get started with agent based modeling
- web application programming using java
- archivecurrikicdn
- about codeteen amazon web services
- data analytics syllabus johns hopkins university
- furman university
Related searches
- university city education foundation
- city university high school memphis
- why this university essay sample
- university city schools mo
- university of minnesota education department
- university school district jobs
- university city high school mo
- university city public schools
- university city st louis
- simmons curve memory foam mattress
- simmons homes tulsa ok
- simmons homes in owasso