create account

The JavaScript Journey #1 - Values by adnanrahic

View this thread on: hive.blogpeakd.comecency.com
· @adnanrahic · (edited)
$19.42
The JavaScript Journey #1 - Values
![](https://images.pexels.com/photos/221174/pexels-photo-221174.png?w=940&h=650&auto=compress&cs=tinysrgb)

## Are you ready to take your first step?

Welcome to a new kind of journey. A path towards making dreams come true. You wouldn't be here if you weren't already hell-bent on learning the ins and outs of programming. Do not let go of that desire. It will push you, be your leading motivation. Okay, let's get down to business, enough of my yapping.

## Intro
First of all, we need to define a bunch of key terms. These are what we will be using in the lectures to come. However, these are also universal things you will need to understand regarding computers and the science around them.

Have you ever thought about how a computer stores memes of cats in its memory? I have. Many times. The technology behind this is equally as mindblowing and putting a man on the moon. No offense NASA, but hey... memes of cats are equally as important, thank you. Anyhow, in the world of computers, there exists **only** data. What does this even mean? Well, anything that is **not** data simply doesn't exist. You can read data, modify data, create new dataโ€”but anything that isnโ€™t data simply does not exist. All this data is stored as long sequences of **bits**, making it fundamentally alike. Ever seen *The Matrix*? The green numbers on the screens, remember them? Yeah, that's how Hollywood represents bits. Kind of cool right?

![](https://images.pexels.com/photos/225769/pexels-photo-225769.jpeg?w=940&h=650&auto=compress&cs=tinysrgb)

But what are they really? They are sequences of numbers only consisting of the digits one (1) and zero (0). If any of you have been in touch with the binary numbering system you'll feel right at home. Everybody else, pay close attention. The binary system **only** consists of these two digits. The zero (0) symbolizes the lack of electrical current in a tiny transistor in the computer's CPU, while the one (1) symbolizes the presence of that same current. But, not to dive too deep into this, that's a story for another lesson. 

Let's see what a sequence of bits looks like:
```
Binary  -> 0    0   0   0    1   1   0   1 
Decimal -> 128  64  32  16   8   4   2   1
```

This binary number you see is equivalent to 13 in decimal. How? It works on the principle of the power of two. The rightmost digit of the number is evaluated as 2โฐ (two to the power of 0). Which is equal to 1. Additionally, if this digit is 1, the value it holds will be 1 in decimal. Otherwise, it holds the value 0. This principle is the same for every other digit to the left. Here's an assignment, if you want to know more, jump over [here](http://www.electronics-tutorials.ws/binary/bin_2.html) to read more.

## Values
Can you now imagine, that a modern computer has more than 30 billion bits only in its RAM. If you're reading this in Chrome, I guess more than 20 billion of those are used by it. Okay, lame jokes aside. Now, you're wondering how the computer knows what is what in this huge amount of bits. But more important, how we as programmers how to use these bits without getting lost. We do this by chopping them into chunks which represent concrete **pieces of information**. These are called values. To create a value you must call it by its name. When you call for it, it will automagically appear before you, right there for you to use as you wish. Every value you create has to be stored somewhere. But, as soon as you no longer need the value it will dissipate, leaving behind the bits to be recycled. These recycled bits will, in turn, be used as the building material for new values. Remember, data is ever persistent. It cannot be created from nothing, nor destroyed. It only changes shapes, as the bits get re-arranged. Where have I heard this before? Hmm...

![](https://images.pexels.com/photos/256369/pexels-photo-256369.jpeg?w=940&h=650&auto=compress&cs=tinysrgb)

## Numbers
Get acquainted with your first data type. A data type represents the shape of the data the bits will create. The Number data type represents numeric values, written like ```13```. Using this in a computer program will cause a bit sequence to form a pattern for the number 13 in the computer's memory. JavaScript uses a fixed number of bits, precisely 64, to store a single number value. Imagine what you could do with 64 binary digits. Well, JavaScript can represent 264 different numbers. Could you guess how much that is? Roughly 18 quintillion. Yeah, that's an 18 with 18 zeroes after it. In translation, a lot. But there's a catch. One bit must represent the sign of the number, whether it's positive or negative. Also, non-whole numbers must be represented, they use some bits to store the position of the decimal point. So the actual real world max value in for a whole number is around 9 quadrillion. Care to guess how much that is? Yeah, still a lot.

![](https://images.pexels.com/photos/106234/pexels-photo-106234.jpeg?w=940&h=650&auto=compress&cs=tinysrgb)

## Fractional numbers 
These numbers are written with a dot. For example ```9.81```.  For scientific calculations, even the *e* notation can be used. Like this ```2.998e8```. However, one important thing must be noted about fractional numbers. They are always approximations. Never, ever, can they be exactly precise. Every calculation with fractions, especially numbers with large fractions, must be treated as approximations. This is the main difference. While calculations with whole numbers up until 9 quadrillion are guaranteed to be precise.

## Strings
Enough about numbers and digits. Let's see how to represent text. Voilรก, strings. A string is a data type which stores all textual input as a string of characters. These characters can be anything, a number, a letter, symbols, special characters, etc... They are all stored in strings, and strings are visually represented with quotes.

```
"The giraffe has a long neck."
'The cheetah can run fast.'
```

But strings have one downside. It's a bit difficult to put some characters in strings. Because a string needs to stay on one line, a newline character is hard to manage. Because of this strings have something called escape characters. They indicate some special function of the escaped character.

```
'First line\nSecond line'
```

This string will be visually represented as:
*First line
Second line*

When a string contains a backslash (```\```) it means the first character after the backslash denotes the special function, in the example above, the ```\n``` symbols a newline character.

![](https://images.pexels.com/photos/278887/pexels-photo-278887.jpeg?w=940&h=650&auto=compress&cs=tinysrgb)

## Summary
You have just scratched the surface of computer science and programming. We covered basic computer memory and bits, and basic values. You now know what numbers and string are. Take a while to let these concepts sink in. Tune in next time, when I'll be writing about arithmetic and operators.

You can read the next lesson [here](https://steemit.com/programming/@adnanrahic/the-javascript-journey-2-arithmetic-and-operators).

---

*Hope you guys and girls had as much fun reading this article as I had writing it!*
*Drop an upvote if you liked it, share if you believe it will be of help to someone.*
*It means a lot to me.*

*Feel free to ask any questions you have in the comments below.*
๐Ÿ‘  , , , , , , , , , , , , , , , , , ,
properties (23)
authoradnanrahic
permlinkthe-javascript-journey-1-values
categoryprogramming
json_metadata{"tags":["programming","howto","education","technology","steemit"],"image":["https://images.pexels.com/photos/221174/pexels-photo-221174.png?w=940&h=650&auto=compress&cs=tinysrgb","https://images.pexels.com/photos/225769/pexels-photo-225769.jpeg?w=940&h=650&auto=compress&cs=tinysrgb","https://images.pexels.com/photos/256369/pexels-photo-256369.jpeg?w=940&h=650&auto=compress&cs=tinysrgb","https://images.pexels.com/photos/106234/pexels-photo-106234.jpeg?w=940&h=650&auto=compress&cs=tinysrgb","https://images.pexels.com/photos/278887/pexels-photo-278887.jpeg?w=940&h=650&auto=compress&cs=tinysrgb"],"links":["http://www.electronics-tutorials.ws/binary/bin_2.html","https://steemit.com/programming/@adnanrahic/the-javascript-journey-2-arithmetic-and-operators"],"app":"steemit/0.1","format":"markdown"}
created2017-06-08 23:49:21
last_update2017-06-10 18:04:39
depth0
children11
last_payout2017-06-15 23:49:21
cashout_time1969-12-31 23:59:59
total_payout_value16.150 HBD
curator_payout_value3.266 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,355
author_reputation1,605,311,705,685
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,436,563
net_rshares3,243,917,414,456
author_curate_reward""
vote details (19)
@kasperfred · (edited)
Great post.

It's good to have a basics of programming series on Steemit. 

When are you going to release the next installment?
properties (22)
authorkasperfred
permlinkre-adnanrahic-the-javascript-journey-1-values-20170609t082205521z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 08:22:06
last_update2017-06-09 08:22:12
depth1
children3
last_payout2017-06-16 08:22:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length127
author_reputation5,969,781,941,575
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,456,985
net_rshares0
@adnanrahic ·
Soon. In a couple of days, I believe. I have a rough outline of the next lesson in my head, only need to put it down on paper. Glad you liked the post! I'm still waiting for your next machine learning related tutorial. :)
properties (22)
authoradnanrahic
permlinkre-kasperfred-re-adnanrahic-the-javascript-journey-1-values-20170609t082832206z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 08:28:33
last_update2017-06-09 08:28:33
depth2
children2
last_payout2017-06-16 08:28:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length221
author_reputation1,605,311,705,685
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,457,176
net_rshares0
@kasperfred · (edited)
It will probably be a couple of weeks before I can post a full length machine learning post due to a flood of upcoming exams.

I'm, however, analyzing steemit data for use in an upcoming tutorial to raise awareness of steemit, and helping the community.
๐Ÿ‘  
properties (23)
authorkasperfred
permlinkre-adnanrahic-re-kasperfred-re-adnanrahic-the-javascript-journey-1-values-20170609t083357922z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 08:33:57
last_update2017-06-09 08:45:57
depth3
children1
last_payout2017-06-16 08:33:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length253
author_reputation5,969,781,941,575
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,457,392
net_rshares51,780,000
author_curate_reward""
vote details (1)
@maxdevalue ·
wow! Followed it till the end, with what am seeing from this intro, programming is scary! but i'd love to know it which is why I payed attention to this wonderful post, thanks for taking your time to teach others,I tell you; this is what our world needs now and steemit has made it more possible and flexible, I wouldn't have known you if not for steemit. thanks once more @adnanrahic, I look out for your next post.
properties (22)
authormaxdevalue
permlinkre-adnanrahic-the-javascript-journey-1-values-20170609t002642086z
categoryprogramming
json_metadata{"tags":["programming"],"users":["adnanrahic"],"app":"steemit/0.1"}
created2017-06-09 00:26:42
last_update2017-06-09 00:26:42
depth1
children2
last_payout2017-06-16 00:26:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length416
author_reputation82,688,667,156,496
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,438,073
net_rshares0
@adnanrahic ·
I feel humbled. I'm glad you liked it. Steemit, and the awesome community has made me want to start writing again. I made a promise to do my best to expand the our programming community. I don't plan on breaking that promise. Cheers man!
properties (22)
authoradnanrahic
permlinkre-maxdevalue-re-adnanrahic-the-javascript-journey-1-values-20170609t003424278z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 00:34:33
last_update2017-06-09 00:34:33
depth2
children1
last_payout2017-06-16 00:34:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length237
author_reputation1,605,311,705,685
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,438,401
net_rshares0
@maxdevalue ·
Welcome sir.
properties (22)
authormaxdevalue
permlinkre-adnanrahic-re-maxdevalue-re-adnanrahic-the-javascript-journey-1-values-20170609t003725722z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 00:37:24
last_update2017-06-09 00:37:24
depth3
children0
last_payout2017-06-16 00:37:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12
author_reputation82,688,667,156,496
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,438,508
net_rshares0
@steemitboard ·
Congratulations @adnanrahic! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/comments.png)](http://steemitboard.com/@adnanrahic) Award for the number of comments

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click [here](https://steemit.com/@steemitboard)

If you no longer want to receive notifications, reply to this comment with the word `STOP`

By upvoting this notification, you can help all Steemit users. Learn how [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
๐Ÿ‘  
properties (23)
authorsteemitboard
permlinksteemitboard-notify-adnanrahic-20170609t090304000z
categoryprogramming
json_metadata{"image":["https://steemitboard.com/img/notifications.png"]}
created2017-06-09 07:03:03
last_update2017-06-09 07:03:03
depth1
children0
last_payout2017-06-16 07:03:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length693
author_reputation38,975,615,169,260
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,453,817
net_rshares51,780,000
author_curate_reward""
vote details (1)
@urs ·
scary stuff....but interesting......
๐Ÿ‘  
properties (23)
authorurs
permlinkre-adnanrahic-the-javascript-journey-1-values-20170609t042320173z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 04:23:30
last_update2017-06-09 04:23:30
depth1
children2
last_payout2017-06-16 04:23:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length36
author_reputation2,910,486,445,829
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,448,054
net_rshares900,341,133
author_curate_reward""
vote details (1)
@adnanrahic ·
It's only scary in the beginning. The feeling of creating something meaningful from a huge amount of jumbled bits is just mind-blowing. :D
๐Ÿ‘  
properties (23)
authoradnanrahic
permlinkre-urs-re-adnanrahic-the-javascript-journey-1-values-20170609t073256546z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 07:33:03
last_update2017-06-09 07:33:03
depth2
children1
last_payout2017-06-16 07:33:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length138
author_reputation1,605,311,705,685
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,455,123
net_rshares855,324,077
author_curate_reward""
vote details (1)
@urs ·
i hope it is..
 try to follow you in the java script thread......
๐Ÿ‘  
properties (23)
authorurs
permlinkre-adnanrahic-re-urs-re-adnanrahic-the-javascript-journey-1-values-20170609t081741717z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-06-09 08:17:51
last_update2017-06-09 08:17:51
depth3
children0
last_payout2017-06-16 08:17:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length65
author_reputation2,910,486,445,829
root_title"The JavaScript Journey #1 - Values"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,456,829
net_rshares855,324,077
author_curate_reward""
vote details (1)