NodeJS, Variables, Input/Output (I/O) MIS 3406 Department of MIS Fox School of Business Temple University
Purpose for these units Who loves to code? Who feels enabled to create new things? Who feels enable to dig into a system, understand exactly how it works and improve it? Who feels ready to build server applications with API in 3502?
Goals Quick refresher of programming focused on programming logic, not all of the HTML and CSS stuff Further develop you programming abilities Get better at the old stuff Learn about new stuff like Passing arguments Reading/writing files Executing host command Position you for success in 3502
What exactly is Node (or NodeJS)? NodeJS = JavaScript – HTML – CSS And is used to develop the server side of applications in client/server systems
What you will need Install NodeJS on your machine After you install NodeJS, you will need to install readline-sync “npm install readline-sync” Install Notepad++ on your machine A love of the command line! Add a contact to your e-Mail called “Email Code” that points to the address HTML_Co.6gh9i2dnxttkl2mt@u.box.com You’ll need to rename the file to be a .txt file to e-Mail it
The basic syntax rules for JavaScript JavaScript is actually pretty forgiving when it comes to missing semi-colons. Still, it is best to end each statement with a semi-colon.
Variables
Rules for naming variables A list of reserved words are on page 59 of your textbook.
Camel casing versus underscore notation theCat theDog theHouse Versus… the_cat the_dog the_house
Naming recommendations for identifiers
JavaScript’s primitive data types Discuss: Can you give me an example of each of these? Can you tell me what these are in your own words?
Examples of number values
Examples of string values
The two Boolean values
How to declare and assign a value to a variable in two statements Notice the use of the var command here. We use var when creating a new variable.
How to declare and assign a value to a variable in one statement
Could it be this easy… …without all of that HTML and CSS stuff
NodeJS isn’t Quite JavaScript Remember… Replace with…
Replacement for prompt
What is an “Argument”?
Hello World with Arguments
Pair Programming Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator,[1] reviews each line of code as it is typed in. The two programmers switch roles frequently. - Wikipedia
What did you learn? Write a program that prompts you for and displays the following information: Your name Your address, with city, state, and ZIP Your telephone number Your college major Can you change this program to accept all of this information as arguments? On the Windows platform, you can wrap strings that contain blanks with quotes to pass them as a single argument. For example: node DisplayInfo.js “Mart Doyle” “13047 Sewell Road” Philadelphia PA 19116…