solución alcance

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

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
Copyright 0utKast ©
  • HTML
<!DOCTYPE html>
<html lang="en" >

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


<p>Solución alcance.</p>
<p id="demo"></p>
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'