English, asked by dhruvimodi55, 2 months ago

explain with examples the scope of the variable in javascript.

Answers

Answered by XxHappiestWriterxX
1

Answer :-

➥ JavaScript has two scopes-global and local. Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your co*de.

➥ Each function has its own scope, and any variable declared within that function is only accessible from that function and any nested functions.

Define JavaScript :-

● JavaScript is a programming language commonly used in web development.

● It was originally developed by Netscape as a means to add dynamic and interactive elements to websites.

● Like server-side scripting languages, such as PHP and ASP, JavaScript co*de can be inserted anywhere within the HTML of a webpage.

Hope you understand this answer mate

Answered by HandSomeBoy68
3

Answer :-

ᴊᴀᴠᴀꜱᴄʀɪᴘᴛ ᴠᴀʀɪᴀʙʟᴇꜱ ʜᴀᴠᴇ ᴏɴʟʏ ᴛᴡᴏ ꜱᴄᴏᴘᴇꜱ. ɢʟᴏʙᴀʟ ᴠᴀʀɪᴀʙʟᴇꜱ − ᴀ ɢʟᴏʙᴀʟ ᴠᴀʀɪᴀʙʟᴇ ʜᴀꜱ ɢʟᴏʙᴀʟ ꜱᴄᴏᴘᴇ ᴡʜɪᴄʜ ᴍᴇᴀɴꜱ ɪᴛ ᴄᴀɴ ʙᴇ ᴅᴇꜰɪɴᴇᴅ ᴀɴʏᴡʜᴇʀᴇ ɪɴ ʏᴏᴜʀ ᴊᴀᴠᴀꜱᴄʀɪᴘᴛ ᴄᴏ.ᴅᴇ. ʟᴏᴄᴀʟ ᴠᴀʀɪᴀʙʟᴇꜱ − ᴀ ʟᴏᴄᴀʟ ᴠᴀʀɪᴀʙʟᴇ ᴡɪʟʟ ʙᴇ ᴠɪꜱɪʙʟᴇ ᴏɴʟʏ ᴡɪᴛʜɪɴ ᴀ ꜰᴜɴᴄᴛɪᴏɴ ᴡʜᴇʀᴇ ɪᴛ ɪꜱ ᴅᴇꜰɪɴᴇᴅ. ꜰᴜɴ.ᴄᴛɪᴏɴ ᴘᴀʀᴀᴍᴇᴛᴇʀꜱ ᴀʀᴇ ᴀʟᴡᴀʏꜱ ʟᴏᴄᴀʟ.

Folow me dear

Similar questions