jquery - Test for array containing a single empty string in JavaScript -



jquery - Test for array containing a single empty string in JavaScript -

i returning array function in javascript , need able know when contains nil single empty string. when print value console, returns this:

[""]

i error if following:

if(myvar == [""]){ // }

how can test value in variable? jquery answers acceptable plain javascript.

i use:

if( myvar instanceof array && myvar.length === 1 && myvar[0] === '' ) { // .... }

javascript jquery arrays json comparison

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -