Notes for You:: Constants in JavaScript - JavaScript Tutorial 12
Constant is a named memory location, whose value never changes during the execution of a program.
In order to grab a chunk of memory location and provide a meaningful name to it, we need to declare a variable or a constant.
Declaring a variable or a constant: means allocating a memory location for some data
In order to change the value in a variable or constant, we need to initialize or assign a value to it.
Initializing a variable or a constant: means putting a data value in that allocated memory location
Syntax:
// declaration and initialization of a constant
const NAME_OF_CONSTANT = value;
// declaration and initialization of multiple constants
const NAME_OF_CONSTANT1=value, NAME_OF_CONSTANT2=value,...;
Note: By default the value of a constant is uninitialized.
Example code:
<script type="text/javascript">
const GRAVITY = 9.8;
document.write("Gravity is=",GRAVITY,"<br/>");
const CANVAS_WIDTH=640,CANVAS_HEIGHT=480;
document.write("Canvas width is=",CANVAS_WIDTH,"<br/>");
document.write("Canvas height is=",CANVAS_HEIGHT,"<br/>");
</script>
Note:
replace < with less-than symbol
replace > with greater-than symbol
=========================================
Follow the link for next video:
JavaScript Tutorial 13 - Naming conventions for Variables & Constants in JavaScript
• JavaScript Naming Conventions - JavaS...
Follow the link for previous video:
JavaScript Tutorial 11 - Variables in JavaScript | JavaScript Variables
• Variables in JavaScript - JavaScript ...
=========================================
JavaScript Tutorials Playlist:-
• JavaScript Tutorials
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
• jQuery Tutorials
jQuery UI Tutorials Playlist:-
• jQuery UI Tutorials
Bootstrap Tutorials Playlist:-
• Bootstrap4 Tutorials
=========================================
HI, I am Manjunath Chidre and I'm an Indian born. I make video tutorials on Computer Science, Information Technology, Animation, VFX, Multimedia, & Gaming courses. Essentially, I set my goal to help students around the world; to learn at free of cost; through my educational YouTube channel Chidre'sTechTutorials.
=========================================
Every video on my channel is made with Love and Hard work, So don't forget to Like, Comment & Share.
Please do Subscribe, Hit the bell icon & Enjoy Learning. It's FREE.
=========================================
Subscribe to our YouTube channel:-
/ chidrestechtutorials
Join as member of our YouTube channel:-
https://www.youtube.com/chidrestechtu...
Become our Patron:-
/ chidrestechtutorials
Visit our Website:-
https://www.chidrestechtutorials.com
Download our Notes from Instamojo:-
https://chidrestechtutorials.myinstam...
Buy our Products on Spring:-
https://chidres-tech-tutorials.creato...
=========================================
Follow us:-
Google My Business:-
https://chidrestechtutorials.business...
Google Blog:-
http://manjunathchidre.blogspot.com
LinkedIn:-
/ chidrestechtutorials
Facebook:-
/ chidrestechtutorials
Twitter:-
/ manjunathchidre
Tumblr:-
/ chidrestechtutorials
Pinterest:-
/ chidrestechtutorials
=========================================
Despite my inconsistent uploads; Thanks for being amazing learners and still sticking with me on YouTube.
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
На этой странице сайта вы можете посмотреть видео онлайн Constants in JavaScript - JavaScript Tutorial 12 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ChidresTechTutorials 29 Январь 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 4,827 раз и оно понравилось 133 зрителям. Приятного просмотра!