esercizi js
This commit is contained in:
73
js2.html
Normal file
73
js2.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
|
||||
var a = [1,2,3,4,5];
|
||||
|
||||
for(i=0;i< a.length;i++){
|
||||
document.writeln(a[i]);
|
||||
}
|
||||
|
||||
(function () {document.writeln("ciao")})();
|
||||
|
||||
function set_property (nome,cognome){
|
||||
return nome + cognome;
|
||||
}
|
||||
|
||||
set_property_gino_paolo=set_property.bind(null,"gino","paolo");
|
||||
document.writeln(set_property_gino_paolo());
|
||||
|
||||
|
||||
|
||||
oggetto = {nome:null,cognome:null,makealert:function(){alert("yoo")}};
|
||||
function set_n_c (nome,cognome) {
|
||||
this.nome = nome;
|
||||
this.cognome = cognome;
|
||||
//this.makealert();
|
||||
}
|
||||
|
||||
(set_n_c.bind(oggetto,"mario","rossi"))();
|
||||
|
||||
document.writeln(oggetto.nome);
|
||||
|
||||
|
||||
|
||||
|
||||
var global="glo";
|
||||
function out(){
|
||||
var global ="loac";
|
||||
function int(){
|
||||
return global;
|
||||
}
|
||||
return int;
|
||||
}
|
||||
|
||||
document.writeln(out()());
|
||||
|
||||
|
||||
|
||||
|
||||
var global="glo";
|
||||
function out2(){
|
||||
var global ="loac";
|
||||
return (new Function ("return global;"));
|
||||
}
|
||||
|
||||
document.writeln(out2()());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user