JavaScript Object Literals

Object literals are a way to define objects in JavaScript using comma-separated name-value pairs of properties and methods. For example, we can define a Customer object with the syntax, which contains properties and a method GetCustomer(): var Customer = { firstname: “Bob”, lastname: “Smith”, email: “”, phonenumber: “555-111-2222”, GetCustomer: function() { return this.firstname + ‘ ‘ + this.lastname + ‘ ‘ + + ‘ ‘ + this.phonenumber; } } … Continue reading JavaScript Object Literals

Installing a Node Web Server using http-server

Node has several web servers available for installation, including http-server: To install, type: npm install http-server -g To start the server, type: http-server This will start the web server at the addresses: Opening a web page at this address will display the contents of the current directory: If we create a folder called webserver with one file, index.html, and browse to this directory, we see the index file is displayed: … Continue reading Installing a Node Web Server using http-server