JSFiddle - React, Tailwind, and code Playground

by viatropos

HTML

<button id='one'>Infinite loop with self referential attribute</button>

JavaScript

var _log = function(string) {
  $('#two').after('<p>' + string + '</p>');
}

// infinite loop
$('#one').click(function() {
  var array = [];
  // self referential attribute
  array.self = array;

  try {
    $.extend(true, array);
  } catch (error) {
    _log(error.toString());
    alert(error);
  }
});