jQuery evaluating function call -


recently found code:

jquery(function ($) {     function tog(v) { return v ? 'addclass' : 'removeclass'; }     $(document).on('input', '.clearable', function () {         $(this)[tog(this.value)]('x');     }).on('mousemove', '.x', function (e) {         $(this)[tog(this.offsetwidth - 18 < e.clientx - this.getboundingclientrect().left)]('onx');     }).on('touchstart click', '.onx', function (ev) {         ev.preventdefault();         $(this).removeclass('x onx').val('').change();         $('#table tr').css("display", "table-row");     }); }); 

it result in this, e. g.:

$(this)['addclass']('x'); 

i've never seen such syntax before. feature of jquery? or es6?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -