• Log In
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Digital Systems

Department of Management Information Systems, Temple University

Digital Systems

MIS 2101.712 ■ Summer 2022 ■ Steven E. Sclarow, AIA
  • Home
  • About
    • Course Materials
    • Course Requirements
    • Email Policy
    • Grading
    • Gradebook
    • Instructor
    • Temple and COVID-19
    • Zoom Requirements
  • Canvas Content
  • Coding Files
  • Helpdesk
  • Zoom Links
  • Video Vault
  • Diamond Peer Corner
  • Posts

What is a variable in JavaScript?

Meghan Gemelli - May 31, 2022 3 Comments

A variable in JavaScript is used to a store data value that may be changed later on. It is essentially a name of storage location. There are two types of variables in JavaScript, and those include; local variable and global variable.

Three rules to follow when declaring a JavaScript variable:

  1. Name must start with a letter (a-z or A-Z), underscore( _ ), or dollar( $ ) sign.
  2. After the first letter, use digits (0-9) 
  3. JavaScript variables are case sensitive (i.e: a and A are different variables because one is lowercase, and the other is uppercase)

A local variable in JavaScript is declared within a block or function, and is only accessible within that function or block. 

A global variable in JavaScript is accessible from any function.

You can declare a variable in JavaScript using “var“, “const“, or “let“.

Reader Interactions

Comments

  1. Steven E. Sclarow, AIA says

    June 7, 2022 at 6:39 pm

    Nice overview describing variables in JavaScript.

    Log in to Reply
  2. Madison Gordon says

    June 13, 2022 at 12:04 pm

    This is a great understanding of variables in JavaScript. Your picture really helps and the rules are very important to know and understand.

    Log in to Reply
  3. Beckett Houck says

    June 19, 2022 at 11:47 pm

    I really appreciate how you cover the different types of variables in JavaScript. It makes the information much easier to understand.

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

ANNOUNCEMENTS

Week 12 Questions

Loops tell the computer to run a function repeatedly. They are useful if … [More...] about Week 12 Questions

Weekly Questions: 13

When it comes to adding the structure to a web page HTML is used. When it … [More...] about Weekly Questions: 13

Week 11 Questions

The purpose of the if/else code in JavaScript is to execute a block of code … [More...] about Week 11 Questions

Weekly Questions: 12

Loops are a sequence of instructions that is repeated until a certain … [More...] about Weekly Questions: 12

Week 10 Questions

A function in JavaScript is a set of instructions that performs a task or … [More...] about Week 10 Questions

Week 9 Questions

A variable in JavaScript is the name of a storage location for data. For … [More...] about Week 9 Questions

Instructor

Steven E. Sclarow, AIA

Email: sclarow@temple.edu
Virtual Office Hour Availability: Tue, 10 - 11:00 AM, or by appointment. Please email me to schedule an appointment outside of my normal office hours.
Virtual Office: https://temple.zoom.us/j/94115790056

ITA CONTACT INFO

ITA
Name: Anna Boykis
Email: anna.boykis@temple.edu
ITA
Name: Jessica Rakhman
Email: jessica.rakhman@temple.edu

Helpful Links

FOX Laptop Policy
FOX Laptop Support

Gradebook

Installing-VS-Code-Windows
Installing-VS-Code-Mac-OS

Copyright © 2025 · Department of Management Information Systems · Fox School of Business · Temple University