I have two scenarios. In each scenerio, tell me which version does the same thing more efficiently (for example, uses less CPU or memory):
The first scenario:
$('body').append('#something');
$('#something').insertAfter('body > *:last-child');
Second window:
$('#something').method1();
$('#something').method2();
$('#something').method3();
var $reference = $('#something');
$reference.method1();
$reference.method2();
$reference.method3();
So, in each scenerio, which version is more efficient?
source
share