Abishek Arumugam Abishek Arumugam - 7 months ago 25
Java Question

Using Common Layers access

I am new to javascript. I am using alert option for displaying map layers. if alert option is true it has to display 4 layers. otherwise it has to display 2 layers.

Trying to write optimized code.
Now I am displaying layers as

if(true){1,2,3,4} else{3,4}
. Trying to write optimized code
{3,4}
as common layers.

if true{1,2, + common layers} else{display common layers}
. Somebody

suggest me code example.

Answer

You can try this,

if(true){
  // Layer1, Layer2.
}
// Layer3,Layer4.