JSFiddle - React, Tailwind, and code Playground

Babel + JSX

class Vector4c {
  constructor(x, y, z, k) {
    this.val = [x, y, z, k];
  }
  
  add(right) {
    const a = this.val;
    const b = right.val;
    return new Vector4c(
      a[0] + b[0],
    	a[1] + b[1],
      a[2] + b[2],
      a[3] + b[3]
    );
  }
  
  norm() {
    const a = this.val;
    return Math.sqrt(
    	a[0] * a[0] +
    	a[1] * a[1] + 
      a[2] * a[2] + 
      a[3] * a[3]
    );
  }
  
  scale(x) {
    const a = this.val;
    return new Vector4c(
      a[0] * x,
      a[1] * x,
      a[2] * x,
      a[3] * x
    );
  }
  
  get(index) {
    return this.val[index];
  }
}

function Vector4f(x, y, z, k)  {
  this.val = [x, y, z, k];
}
Vector4f.prototype.add = function (right) {
    const a = this.val;
    const b = right.val;
    return new Vector4f(
      a[0] + b[0],
    	a[1] + b[1],
      a[2] + b[2],
      a[3] + b[3]
    );
  }
  
Vector4f.prototype.norm = function () {
  const a = this.val;
  return Math.sqrt(
    a[0] * a[0] +
    a[1] * a[1] + 
    a[2] * a[2] + 
    a[3] * a[3]
  );
}

class Vector4s {
	constructor(x, y, z, k) {
    //if (typeof x === 'float32x4') {
      this.val = x;
    //} else {
    //	this.val = SIMD.Float32x4(x, y, z, k);
  	//}
  }
  
  add(right) {
    const b = SIMD.Float32x4.add(this.val, right.val);
  	return new Vector4s(b);
  }
  
  norm() {
     const sqred = SIMD.Float32x4.mul(this.val, this.val);
     return Math.sqrt(
     	SIMD.Float32x4.extractLane(sqred, 0) +
      SIMD.Float32x4.extractLane(sqred, 1) +
      SIMD.Float32x4.extractLane(sqred, 2) +
      SIMD.Float32x4.extractLane(sqred, 3)
     );
  }
  
  scale(x) {
     const a = SIMD.Float32x4(x, x, x, x);
     return new Vector4s(SIMD.Float32x4.mul(this.val, a));
  }
  
  get(index) {
    return SIMD.Float32x4.extractLane(this.val, index);
  }
}

const IRT = 1000000;

const foo = new Vector4c(1,2,3,4);
const bar = new Vector4c(4,3,2,1);

const foof = new Vector4f(1,2,3,4);
const barf = new Vector4f(4,3,2,1);

const foos = new...