This booklet is part of a series covering specific levels of digital/web literacy based on HTML and related technologies. Each one is somewhat independent of the other in the sense that a reader may approach one subject without reading another previously published.
The book was kept short on purpose and it represents a level of knowledge covering essential techniques the reader may use forever.
Who Should read this book?
This booklet has been written for those who really want to learn programming as part of their general education. The author assumes the reader has no prior knowledge on the subject. The only prerequisite is an open mind and willingness to try something new.
Please check it out and let me know if it helped you.
Use the free Kindle app to read this and other eBooks on your computer.
Imagine a musical metronome with a big arm swinging left and right.
Imagine that each time the arm clicks left, right, left, you say out loud 5, then 6, then 7, etc.
Ok, in the script above, the ticking of the metronome is a temporary variable called i.
The script above takes an arbitrarily named variable, i that keeps pointing at numbers, starting at 5 and stopping at 50 (inclusively). That’s the ticktock of the metronome.
Console.log() prints out each number at each position of i.
i++ is a shortcut that means “increment by 1”, which happens once on each cycle of the loop.
for i starting at 5, i less than 50, increment i
while incrementing, print each time, the value "at" i
I’ve got a new booklet on Amazon titled “Drawing Six ‘Lucky’ Numbers”.
On this first booklet the project goes under the following rules
• To fetch five random numbers ranging from 1 to 75
• To fetch a sixth random number ranging from 1 to 15.
• The first five numbers cannot be repeated.
• Zero is not allowed.
• Numbers should be displayed in numerical order from the lowest to the highest, except for the sixth number, which stands on its own at the extreme right.Easy enough, right?If it sounds like a lottery drawing, it is because the rules for drawing numbers are identical to a known national game.
Hey, perhaps you will get lucky with it since random numbers are random numbers!
Don’t forget about me if you ever make it!
The booklet covers fundamental concepts such as:
• Searching numeric arrays.
• Using For loops.
• Isolating code with functions.
• Usage of Math random, ceil, floor and round.
• How to separate code by its functionality.
• A practical application of indexOf
• Practicing using a Console.
• Displaying an Array as string
Give it a try, it’s only 99 cents in the US, less than a cup of joe!
If you’re interested follow this link or click on the image:
// Single variable declaration:
var x = 10;
// multiple variables declaration:
var y = 5,
z = 7,
a = "Hi there"
// above, notice the semicolon at the end (and no comma after the last item)
// And in loops:
for (i = 0; i < 5; i++)
// be aware that unless a loop is inside of a function,
//i will remain global after the loop is over, holding the very last value.
It is best to declare all variables on the top of their scopes. In Function scope they can also be grouped with one single var.
// variable declaration inside of functions
var c = 10,
d = 2
return c * num / d;
You can read more about those issues on my latest book.
Use the free amazon “Kindle for PC” app to read it on your computer.