our ($var1, $var2) = ('G1', 'G2'); #globals
sub funA {
print $var1 . "\n";
print $var2 . "\n";
}
sub funB {
local $var1 = 'B1'; #dynamic scoping
my $var2 = 'B2'; #lexical scoping
funA;
}
funB;
^"([^\\"]|(\\.))*"$
function Dog(name) {
this.name = name;
}
Dog.prototype.nice = true;
Dog.prototype.meet = function() {
return this.name + " " + (this.nice ? 'wags its tail' : 'barks');
}
var d1 = new Dog("Daisy"), d2 = new Dog("Buster");
d2.nice = false;
document.write(d1.meet() + "<br/>\n");
document.write(d2.meet() + "<br/>\n");