20 Getting started .html scope.js l conflict. without functions different in used be can name variable same the so – function own their throughout unique be need only names variable local but script entire the throughout unique be must names variable variables.Global other with conflict accidental possible prevents scope limited their as variables global to preferable generally are variables Local • • declared: is variable the where by determined is its “scope” and called is accessible is variable a which to extent The Recognizing l l l 4 3 2 1

known asa “ withinanysois function inthatscript – itisaccessible globally code withinany function block. hasThis variable “global” scope known asa “ withinthat function, accessible locally scope –itisonly sois code withinthatsamefunction block. “local” hasThis variable A variable declared outside all function blocks isaccessible functionto outsideall blocks declared A variable accessible to isonly insideafunction block declared A variable In the functiontheIn block, declareinitializeandvariablelocal a loaded has document the after execute to function a Add a initialize and declare then editor text plain a Open Create a HTML document that embeds an external external an embeds that document HTML a Create var obj=document.getElementById(var “ window.onload=init; } { init() function var global=” var variable global