Before the lab
- Study for Quiz 1
- Read Values, Types and Operators
~/cs2613/labs/L08/hello-world.js
console.log("Hello world");
open a terminal, find the right directory
$ node hello-world.js
commit your file
Start Firefox
Open the "Web Console" with Ctrl-Shift-K (or navigate via the "hamburger menu" to "Web Developer -> Web Console" ).
Select the tab "Console"
Copy-paste the code in.
Start up a node repl
$ node
Load your code into the repl
> .load hello-world.js
Evaluate some expressions
> 1 + 1
> "Hello " + "world!"
make a new file ~/cs2613/labs/L08/expr.js
and fill in the JavaScript expressions
equivalent to the given Racket expressions.
.load
.note that if you want to run your code from the command line, you'll need to use console.log
//(string-append "Hello\n" "world!")
//(* (+ 1 2 3) 7)
//(< 41 (* 6 7))
//(equal? (* (+ 1 2 3) 7) 42)
//(equal? "Spongebob" "Squarepants")
//(and (equal? (* 6 7) 42) (equal? "Spongebob" "Squarepants"))
//(equal? 42 (if (< 3 5) (* 6 7) "turnip"))
// (or #t (/ 1 0))
// (and #f (/ 1 0))
You will be given question(s) on paper.
Test cases will be available on-line after the start of the quiz.
Make sure you have any study materials in your home directory before the lab, as internet access will be restricted.