javascript - How to use AND Operator -



javascript - How to use AND Operator -

if utilize this, not work

if (levelspecificdata.labelfont) if (levelspecificdata.labelfont !== "arial" || levelspecificdata.labelfont !== "arial black" || levelspecificdata.labelfont !== "arial narrow" || levelspecificdata.labelfont !== "verdana" || levelspecificdata.labelfont !== "trebuchet ms") homecoming false; if (levelspecificdata.labelfont !== "arial") homecoming false;

or operator

if (levelspecificdata.labelfontsize) if (levelspecificdata.labelfontsize < 2 || levelspecificdata.labelfontsize > config.20) homecoming false;

so utilize comparing between strings utilize , operator

if (levelspecificdata.labelfont) if (levelspecificdata.labelfont !== "arial" && levelspecificdata.labelfont !== "arial black" && levelspecificdata.labelfont !== "arial narrow" && levelspecificdata.labelfont !== "verdana" && levelspecificdata.labelfont !== "trebuchet ms") homecoming false;

use array font names , check if contains value:

if (levelspecificdata.hasownproperty("labelfont")) { if (config.fonts.indexof(levelspecificdata.labelfont) < 0) { homecoming false; } }

where config object settings including font array:

config = { somesetting: 'somevalue', anothersetting: 'anothervalue', fonts: ['arial', 'arialblack', 'arialnarrow', 'verdana', 'trebuchetms'] }

javascript node.js

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -