solución alcance

In this example below you will see how to do a solución alcance with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 0utKast, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 0utKast ©
  • HTML
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>solución alcance</title>
  
  
  
  
  
</head>

<body>

  <body>
<p>Solución alcance.</p>
<p id="demo"></p>
<script>
function retrasarSaludo(nombre) {
    this.nombre = nombre;
    this.hola = function () {
        var _this = this;
        setTimeout(function () { return alert('Hola ' + _this.nombre); }, 0);
    };
}
var saludo = new retrasarSaludo('Pedro');
saludo.hola(); // alerta 'Hola Pedro'
</script>
</body>
  
  

</body>

</html>

Comments