Skip to content

Instantly share code, notes, and snippets.

function Person(name, surname, yearOfBirth){
this.name = name;
this.surname = surname;
this.yearOfBirth = yearOfBirth;
}
Person.prototype.sayHello = function(){
console.log("Hello! My name is " + this.name + " " + this.surname);
}
{ name: 'Mario', surname: 'Rossi', yearOfBirth: 1980 }
function Person(name, surname, yearOfBirth){
this.name = name;
this.surname = surname;
this.yearOfBirth = yearOfBirth;
}
var mario = new Person("Mario", "Rossi", 1980);
console.log(mario);
var mario = new Object();
mario.name = "Mario";
mario.surname = "Rossi";
mario.yearOfBirth = 1980;
console.log(mario);
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://miousername:miapassword@github.com/asiletto/js.class.git
[branch "master"]
remote = origin
$ git clone https://github.com/asiletto/js.class.git
Initialized empty Git repository in /root/temp/js.class/.git/
remote: Counting objects: 433, done.
remote: Compressing objects: 100% (312/312), done.
remote: Total 433 (delta 133), reused 404 (delta 107)
Receiving objects: 100% (433/433), 425.42 KiB | 598 KiB/s, done.
Resolving deltas: 100% (133/133), done.
$ ls
js.class
$ git add *
$ git commit
[master 5b028a5] page structure
4 files changed, 65 insertions(+), 22 deletions(-)
$ git push origin master
Counting objects: 20, done.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 2.37 KiB, done.
{
"name": "node-test",
"version": "0.0.1",
"description": "node.js examples",
"main": "index.js",
"dependencies": {
"router": "~0.6.2"
},
"devDependencies": {},
"scripts": {
$ npm init
name: (node) node-test
version: (0.0.0) 0.0.1
description: node.js examples
entry point: (server-mod.js) index.js
test command:
git repository:
keywords:
author: Alessandro Siletto
license: (BSD) GNU GENERAL PUBLIC LICENSE V2
$ node hello-router2.js
server started
...
$ wget -nv -O - http://localhost:8080/hello/Pippo
hello Pippo!
$ wget -nv -O - http://localhost:8080/goodbye/Pluto
goodbye Pluto!