We can do the same thing inside of here, the same rules apply. We need to be careful about using quote marks inside of strings. The only thing that’s not valid is another quote mark because that ends the string and now I have a quote mark sitting out here all by itself without having a match. We can add a whole bunch of weird special characters, letters, and numbers. It doesn’t know it’s trying to do 7-11 and some other weird things in here.īut when we wrap a value in a string, in quotes, it creates a string at which point we can put any valid alphanumeric character we would like inside the string. That’s because this default blue color in my current scheme is trying to look for a variable with this name. If I were to copy this and place it outside quote marks, you’ll notice that the coloring in my editor is very differently. You’ll notice that all remains the exact same color because it’s within the quote marks. Then, inside of the quote, I can put whatever I want. I typed the word, “string”, but the quotes is what I need to actually say that I am creating a string. Double quote and single quote behave identically, and the backtick character comes with some extra functionality. I start a string by typing double quotes, single quotes, or the backtick character. Some of the most simple and common types that we’re gonna encounter are first, strings and then numbers, and then booleans.Ī string is a collection of alphanumeric characters. Strings, Numbers, and Booleans – the Most Simple and Common Data Types We need to learn those types and when to use the right ones in the right scenarios. Its got different buckets for the different types. For now, just remember that the computer thinks about data and information differently. We’ll review exactly how to write the syntax for each one in the future, as well as why you might want to use one over another. These are only some of the data types that you will be using. An object or array are collections, a way to group together multiple points of data into a single bundle that we can pass around using access. Two other common data types that we’ll talk about later are objects and arrays. Two Other Common Data Types: Objects and Arrays It also means empty or nothing, but it’s that way because a developer told it it was empty or nothing. Null is similar to undefined, except it has to be set intentionally. It is nothing because no one has ever bothered to tell it what value it should be. The undefined data type means that the variable has been created, but has never been given a value. They represent all data that only has two states, like a light switch. Computers will often use numbers to perform mathematical operations, but they may also just be a number like a count of how many flavors of ice cream a particular store has.īooleans can only have two values. They’re numbers, including both integers and decimals. This is how we’re gonna store letters and words. Strings are collections of alphanumeric characters and symbols. Let’s go through our brief overview of each type of data and what it can be used for. Overview of the Five Most Basic Types of Data It’s important that you remember and practice these differences, otherwise, data could get stored in an improper format and bite you later. The computer is gonna identify what type of data you’re working with based off of the syntax, or the way that you write the code. That means it’s important for you to learn to store the data correctly. A single variable can only store a single type of data. We refer to these as primitive data types. The five most basic types of data are strings, numbers, booleans, undefined, and null. In Javascript, there are five basic, or primitive, types of data. Data types describe the different types or kinds of data that we’re gonna be working with and storing in variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |