constructor() for creating Web Audio Oscillators?
So I have a function that can get a value through Function.
function $(e) { return sq.constructor('return ' + e)(); }
var context = $('new (window.webkitAudioContext || window.AudioContext)');
I'm using this to create oscillator sounds in the PJS environment. Is this allowed?
https://khanacademy.org/cs/i/5573412618027008
Squishy's Piano Roll used eval, but this uses Function which is considered safer according to the documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!
Please sign in to leave a comment.