Category: Javascript

Resize Fabric js Canvas

  canvas.setWidth( <desired width> ); canvas.setHeight( <desired height> ); canvas.calcOffset();  

Read more

Order Array By Int, Float, Text Value Javascript

  var arrayVar = [ { name: ‘Bobby’, someValue: 123123 }, { name: ‘Phillip’, someValue: 123 } ]; arrayVar = arrayVar.sort((a, b) => {return a.someValue – b.someValue}); // save the sort result // (a – b) = Ascending sort, (b – a) = Descending sort console.log(arrayVar);

Read more

Speech Recognition With Javascript

  var grammar = ‘#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | […]

Read more

Extract JSON String from Page Element with Javascript

var somePageElement = ‘{ “name”:”John”, “age”:30, “car”:”Tesla” }’; var jsonString = ‘[‘ + somePageElement.split(‘[‘)[1].somePageElement(‘]’)[0] + ‘]’;

Read more

How to make a pop up with javascript

function WelcomeMSG () { alert(“The river will start flowing soon. Please bear with us while we are under construction.”) }

Read more