JSFiddle - React, Tailwind, and code Playground

by hellosze

HTML

<h1>Array Swap</h1>

JavaScript

Array.prototype.swap=function(a, b)
{
	var tmp=this[a];
	this[a]=this[b];
	this[b]=tmp;
}
var a = [1,2,3];
a.swap(0,1);
console.log(a);