Learning objectives:
Let’s keep moving on and learning new concepts in javascript, in this topic we will get familiar with:
Study: Strings
Strings, likewise numbers, are very important data types in JavaScript. A string is simply a piece of text… and is a fundamental building block of the language.
-
Read and code along with yet another MDN tutorial on the topic: Handling text — strings in JavaScript. (Dedicate at least 90 minutes on this material)
-
Go through this lesson: JavaScript String Methods to learn more about what you can do with strings… be sure to do the exercises at the end! Suggested reading and coding time for this material: 90 minutes After reading this post, you must ensure that you have a firm understanding of the following String properties and methods:
- The
.length
property - The following String methods:
- indexOf()
- lastIndexOf()
- search()
- slice()
- substring()
- substr()
- replace()
- RegEx
- toLowerCase()
- toUpperCase()
- concat()
- trim()
- charAt()
- charCodeAt()
- split()
- Let’s now learn what a method is: a method is a bit of functionality that is built into the language or into specific data types. In the previous W3Schools exercise, you learned a few methods that can be used on strings, such as
indexOf
andsearch
. However there a lot more methods that can be use on strings. An exhaustive list can be found here: String methods.
Study: Conditionals
Up until now we haven’t done much with our programming. We have told the computer to do some math but the the essence of programming is teaching the computer how to make decisions. In other words we need to tell the computer when to do certain things. And the way we do it is with the conditionals.
So now it is time to have fun!
-
The first step in learning about conditionals is making sure you understand comparisons: JavaScript.info – Comparisons. (Estimated reading and coding time for this material: approx. 1 to 2 hours
-
JavaScript if, else and else if you will get a first glance at conditionals in JavaScript. (Dedicate at least 1 hour on this material)
-
Logical Operators you will learn about logical operators. (Dedicate at least 1 hour on this material)
-
Making decisions in your code — conditionals provides several interesting examples of how you could use it building websites. (Estimated reading, practice time and completion of exercises: approx. 10 hours)
Supplementary Material:
-
Conditional branching: if, ‘?’ covers the same basic concept (read through it as a review!) Furthermore it offers the usual ‘tasks’ at the bottom of the page!
-
How To Use the Switch Statement in JavaScript will teach you about the
switch
statement.
BOOKMARK THIS: This last resource has been created by Tania Rascia. Tania is one of the best online educators when it comes to Frontend and web technologies, so make sure to follow here on twitter, join her newsletter and definitely bookmark her website which contains a lot of amazing tutorials and posts. Whenever you find yourself troubled or tangled up in a difficult concept, search Tania’s posts and tutorials for it. Chances are, you will find yourself a clear explanation.
Time for Practice
In order to give you more practice and more exercises to play with we have created ome repl.it exercises.
Make sure that you do the exercises in the given order.
Instructions: Pressing run
at the top will run the code. Read all directions, watch the terminal, and read all the errors. Don’t forget to use console.log
extensively.
Assignment
Your instructor will share a link to the assignment repository. Work on your assignment and submit your Pull Request link in the Quiz below.
Additional Resources
In this section you can find a lot of helpful links to other content. This is a supplemental material for you if you want to dive deeper into some concepts.
-
Take a 10 to 15 minutes break and watch The Net Ninja’s Regular Expressions Tutorial. Don’t worry if you feel overwhelmed by the concept of Regular Expressions as it’s one of the most difficult and awkward computer languages. All that we want at this point, is for you to gain some basic understanding of how this pattern matching language works and become familiar with this undeniably powerful feature of most programming languages.
-
If you feel comfortable, continue to this site and practice yourself with some
easy
tomedium
pattern matching tasks.
Estimated viewing and coding practice time: approx. 3 hours