for example here i've named this variable my car which is an indication that the type of data i'm storing is relating to cars notice the two difference in the two values here this one here the value is seven which is a number and notice here the value here is a posh and i've put quote around it when you are declaring variables if you are declaring a text you have to enclose it in quotes you either have to use single quotes or double quotes but you can't mix them you can't use a single quote here and then a double quote here that's the only way the computer will understand that it is dealing with a text you need to enclose the values in quotes you don't need to do that with numbers because the computer knows that that is a number but if you want the computer to know that is a string they call it a string in programming if you want to know that this is a string you need to enclose it in quotes also notice i've used semicolons here which is important that indicates that that is the end of that statement a javascript program is basically a collection of statement this indicates this is one statement this indicates this is another statement because of the semicolon so you have to do that when you're declaring variables you can also declare variables without assigning them a value so when you declare a variable without a value it is known as undefined once you have defined or declared a variable you can change its value for example here i've already defined a variable called my car if i wanted to change the value from posh for example to a rim driver all i need to do is call the variable by name and assign it a different value so that way i've already changed the value once you've declared the variable you can change the value a variable that is declared without a value is known as undefined also it's very important to know that javascript is case sensitive so for example here i've declared this variable my car with open case c if i try to reference it with a lower case c it will not work you can experiment with javascript inside your web browser console if you are using a mac you can access your web browser console by clicking on option command and j once you've got the web browser open if you are on a windows based computer once you've got the web browser open you can just press f12 that will give you the web console i've got the google on page open so i'm going to access the web console just by hitting the f12 on the keyboard and that will give me the console so this is this is the developer console where you can experiment with javascript so there are different ways you can dock it so if you click here at the moment is dock to the side you can also dock it to the bottom and that will give you the page the web page you're currently viewing and then you can experiment with the code on the side or you can do it on this side dock it to the left so depending on whatever you fancy you can dock it wherever you like i'm going to just dock it underneath for now so let's try and experiment with some javascript so i'm going to declare a variable inside the console here i'll just type in var to declare a variable and i'll give the variable a name of x give it a value of seven so now if i want to call this variable all i need to do is call the variable by its name if i press x it will return the value of seven now that i've declared the variable i can also change its value all i need to do is call it by its name use the equals two and assign it a different value now if i call the variable x again it no longer stores seven but it now stores eight same thing if i declare another variable called let's declare a new variable i'm going to call this variable my car okay my car okay you know i'll give it my car and i'm going to give it a value of say posh okay and i need a semicolon to end that so now if i call this variable by its name if i say for example if i call call it by car it will not work you know why because i've referenced it in lower case you know the c i use this in uppercase so it's very important that you reference your variables the way you've defined them if i now go back and call it again with uppercase c it should return the right you can see it's giving me the value of posh and once you've declared the variable you can easily change its name change its value so if i want to change that to something else i'll just call it by name so i want to change this to a ford for example and to a semicolon now that's changed it if i call the variable again by name it will no longer store range of it will be now storing ford so these are some of the basic examples you can use to play around in the browser console the console is very useful for playing around with little little little values like this so you can experiment and get acquainted so that's it for this video on javascript variables many thanks and bye for now hello and welcome in this video i'll be showing you some variable naming convention these are basic rules that you need to follow when giving you a variable names so i'm just going to read through this table so the first thing to take into account is that variable names cannot start with numerical for example you can't use a number you can't name a variable 3x or four cars just for example those would be illegal variable names however you can combine the numbers with text you can call a variable maybe cars four or go for it and things like that they are perfect valid variable name you cannot use operators operators i mean either mathematical or logical operators you can't use that in variable names for example you can't call a variable this plus that or this minus that or this times that you can't do that you cannot use any punctuation marks of any kind in a javascript variable name other than the underscore so you can't call your variable car colon or car hash but you can use an underscore underscore is allowed so you can give your variable name underscore car for example or something underscore something nothing that is allowed javascript variable names must never contain spaces never for example you can't name your variable my car space car that's not allowed however you can give it my car that is legal there cannot be any spaces between variable names variable names are case sensitive for example if you declare a variable called my car is different from a variable called my car or my car they are all different variations so when you're declaring variable names you've got to be careful the case you use so that when you want to refer to that variable name you are referencing the correct variable it's like having the key to the wrong door if you don't have the right key you will not be able to open the door so you must make sure you have your variable names correct in the correct case finally you cannot use any javascript keywords keywords are parts of the javascript language itself you can't use any of that for variable names for example window is a keyword in javascript it's part of the language things like open is part of the language location or string those are all parts of the javascript language so it will be illegal to use them on their own however you can use them in combination with other things or that other key was for example you can call a variable that window or maybe my string or whatever you can combine them with other text that is acceptable so these are just some key basic rules you need to take into consideration when you are giving your variable names that's it for this video thank you for watching bye for now hello and welcome in this video i'll be introducing you to javascript arrays what is an array an array is basically a structure that allows you to store multiple values in one single reference basically what that means is that it stores multiple values in a single variable so an array is a special variable which can hold more than one value at a time in comparison to a variable that can only hold one value at a time an example of an array is this here for example you create an array called my data and you use the equals to to assign the values you can tell it's an array because the values of an array are enclosed in square brackets also you can have different data types in an array in this example here i've got both number and string data type as values in an array so let's create a simple array using our web console to create an array you have to create the variable first so you just type in var to create or define the variable you do a space followed by the name you want to call the variable i'm going to call my my my data you then use the equals to sign to create the array and use the opening square brackets and you add the values or the elements in the array you can mix data types in my example here i'm going to mix the data type with a string and also a number so i've got a number and a string i'm going to add another number and then i'll add another string when you are using string don't forget to enclose them in quotes and when you are using arrays you separate each of the elements in the array by a comma you can see i've got comma here and comma here only the last value or element that does not require a comma so now that we've created an array to call the array we just need to call it by its name which is my data and it will display the information the information here tells you that we've got an array of four elements which is one two three four and it gives you the values if i expand this you will see all these figures here they are known as index the way you access the elements in an array is by the index so the very first element of value has index zero the next one will have index one and so on you can see here index zero belongs to seven index one belongs to john index two belongs to seventeen index three belongs to jane and so on tells you here the length of the array is four because it has four elements or values inside the array so if i wanted to access jane what the way i would do that would be my data and then square bracket and i'll type in three because that's the index for jane and press enter and it's giving me the value of jane because jane has an index of three as you can see here from the index so always remember that when you're trying to access the values in an array you have to access them using their index and the index starts from zero upwards when you work with arrays it is easy to remove elements and also add new elements to an array using a process called popping and pushing if you want to add elements you use a method called pushing to add an element and if you want to remove you use a method called popping so popping will remove and pushing will add an element to an array so let's add an element to our array and the way we do that we call the array by its name which is in my case is called my data and then you add a dot and type in push and then in parentheses you specify the value you're trying to push into the array so let's see i'm trying to add a number 10 into the array and i press enter so you can see now it's now showing that the array has five values so if i want to call this array again called my data it will now show that the length is five you see because i've now added a new element which is this number 10 here so if i expand that you can see the index we've got a new index four four which is number 10 if i wanted to remove an element from the array okay so i can do that using the pop method the pop method will remove the value that i've just so let's remove the value i've just added so i'll type in my data dot pop and this will remove the very last value i have just added on you can see here tells me 10 has been removed so if i now reference this array now it should go back to the original value which is an array of four you can see here this is the original length so that's basically how you can add and remove an element from an array so this concludes this brief introduction to javascript arrays there are other types of arrays and there are so many things you can do using javascript array this is just an introduction to what an array is thank you for watching and bye for now hello and welcome in this video i will introduce you to some javascript data types in programming in general and also in javascript the data types basically refers to the classification that specifies the type of value that a variable has or stores there are different types of data types in javascript here's a basic table with some basic javascript data types so i'm going to start with the top one which is a string a string basically is a sequence of text that must be enclosed in quotes you can use either single quotes or double quotes but you cannot mix the quotes for example here you can declare a variable called my data and set it to this value you can see i've got quotes around it i've got my web console open so the way to access your web console if you are on a windows computer open up just google homepage and type in control shift and j on your keyboard or f12 and that will give you access to the web console if you are on a mac you do command shift and j that will give you access to the console so let's create a simple variable that will store a string data type so in my console i'm going to create a new variable by typing in the keyword var and i'm going to call this variable my colors okay and i'm going to give it a value i'm going to give this value of red so that's the value you can see i've enclosed the value in quotes which means it's a string data type the computer will recognize that as a string data type so if i want to reference this variable all i need to do is call it by its name and it will just return the value red so that's a simple example of how a string data type can be used the next data type i want to mention is the number data type basically refers to any numerical value and it does not need to have a quote around its value so let me illustrate by creating a simple variable that will store a number data type so i'll declare a simple variable by typing in the keyword var and i'll call this variable don number and i'll give it a value of seven so this is known as a number data type you can see it doesn't need quotes around it so if i want to reference that variable i just call it by its name don number and it will return a value of seven the next data type i want to mention is called boolean a boolean basically represents two values one can be true the other can be false and when you're using boolean values no quotes required to illustrate a boolean value i'm just going to compare two values i'm going to say four is greater than three that will return true and if i say three is greater than four and that will return false so that's basically how boolean value data types work the next data type i want to mention is called an array an array is a data structure that stores multiple values as one single reference basically what that means a variable can store only one value but with an array you can store multiple values as one single reference you can see here i've got two values here ford and Toyota but i'm referencing it under one variable called my cars so let me show you a quick illustration inside the console so i'm going to declare a variable called my cars and i'm going to set it to equals two and this is how you declare an array with square brackets and inside the square brackets is where you place the values so let's say the first value i say it's a ford and second value i say is a Toyota when you are using arrays you separate each of the values with a comma but the only where you don't need a comma is a very last value so this basically here is an array and the way you access the values in an array is by their index so the way an array is referenced is by their index so this will be known as a zero index this will be one if you have several you can have as many as possible inside the square brackets but you need to separate the values with a comma and if they are of a string data type you enclose it in quotes if they are not then you don't need to enclose it in quotes so for example if i wanted to access value number one this is zero index zero which is ford all i need to do is type in my cars and in lowercase type in my cars and then in square brackets i type in value zero which will represent the index i'm trying to target and that should return you can see it has returned ford so that's how you if i had like 20 inside here i will reference it by the index based value number so ford the very first value is a zero index Toyota will be index number one and so on so that's how you access the values in an array so the key difference between an array and variable is that an array can store multiple values as one value if you see here i got just got this variable called my colors and it's only stored one value here i've got a variable called my cars and it stores multiple values but reference as a single values called my cars the next data type i want to quickly mention is called the object everything in javascript is basically an object so all the examples i've shown so far they are basically objects you can also represent javascript objects with curly braces as i've done here i've declared a variable called person and set the value to equals to the first name got john last name though so you can represent an object like this way as well but by using curly braces so if i wanted to access this object here all i need to do is call the variable by its name and it will return the you can see it's returned the first name as john last name as do another data type i want to introduce you to is called null you may come across this in your learning with javascript and basically a null data type is something that does not exist you can also use the null data type to empty the value of a variable and a null is also an object data type so you can see here i've got a variable here called dot number and with a value of seven so i can empty that value by just typing in the name of the variable which is dot number and setting the value to null and that will empty the current data it stores if i call this variable called dot number now it will come back saying null because i've emptied out the whatever it was storing okay so a null data type means basically nothing it doesn't store anything there's nothing in there the final data type i want to talk about is called undefined undefined is similar to null the only difference is that they are different data type undefined is undefined while a null data type is also an object data type well if you declare a variable and you don't give it a value that will become undefined for example if i come here and say variable sweets and i don't give it any value that would become undefined if i try to call it by its name it will come back undefined so that's the key difference key difference between a null and undefined is that undefined is not an object data type while null is an object data type so that's basically it for this video on javascript data types thanks for watching bye for now hello and welcome in this video i'll be showing you some basic examples of how you can mix data types when you are creating certain variables or objects in javascript you can mix the data type for example in an array you can have an array that contains a string and also a number so let me create a very basic variable i'm going to create a variable and i'm going to call this variable x i'm going to give it a value which is going to be an array you can tell it's an array because i'm using square brackets and i'm going to give the first value in the array i'm going to make that a string we'll call that john so you separate each value in an array with a comma and i'm going to make the second value in the array a number so here i've created a basic object which is an array that has two values which is also known as the length so the length of this array is two so if i press enter it comes undefined because i've not referenced it so if i want to reference it i just call it by its name which is x and press enter so it tells me here that this is an array and it has two values or length two and it tells you here the values john and zero so if i expand this now you can see an array basically is referenced by the index so the very first value will be index zero and the second value with it will be index one so if i wanted to access for example this value called seven i'll have to reference it by this index one and it tells you a length that means the length of the array is two it's got two values so you can see it's possible to mix data types so i've mixed a string and a number data type inside an array object when mixing data types you also have to be careful because it can lead to some unexpected results for example when you are performing calculation so you've got to be careful not to mix a string value and a number value so let me illustrate so let's say i create a variable a and give it a value of say seven plus seven all right and i create another variable i'll call this variable b and i'll give this a value of seven plus seven so i've got two variables now if i call variable a variable a will return a value of 14 which is seven plus seven if i call variable b it will return a value of 77 because the first value is a string so it uses this plus sign to concatenate or add this seven to the string so if i call the variable b now it will return 77 so you've got to be careful when you're doing calculations so as not to mix a string and a number if you don't want unexpected results it's okay if you're expecting the values that gets returned but if you're not expecting it then you need to be cautious when you are mixing a number for example and a string if i for example create another variable here i'll call this variable c and i'll set that to equals to say a string and i'll call this hello and i'll concatenate this i'll add a number seven now if i call this variable c i expect it to return hello seven all right so that's basically how you mix variable but you gotta be careful when you're doing calculations so you don't get unexpected results so that's basically it for this video thank you for watching and bye for now hello and welcome to this video in this video i'll be introducing you to javascript operators an operator is a mathematical symbol which produces a result based on two values or variables you should have already come across some of these operators and for example the addition multiplication subtraction and division these are all referred to as arithmetic operators there are different types of operators in javascript we've got the arithmetic operators we've got the assignment operator we've got a string operator sometimes called concatenation we've got the comparison operator we've got the logical operator and the type operators i will be briefly explaining each of these operators in separate videos thank you for watching and bye for now hello and welcome to this video in this video i'll be explaining what arithmetic operators are and also showing you basic examples arithmetic operators are operators that are used to perform arithmetic actions or functions on numbers or variables here's a table of some basic arithmetic operators so i'll start from the top where we've got the addition operator and basically that is used to add numbers or values together for example two plus two we've got the subtraction operator which is used to subtract numbers or values example four subtract two next we've got the multiplication operator which is basically used to multiply numbers or values example seven times three in programming and in javascript multiplication is represented by the asterix symbol next we've got the division which is used to divide numbers or values example we divide four by eight next we've got the modulus which is represented by the percent sign a modulus operator is used to return the remainder from a division so when you divide two numbers modulus will return only what is left from the division next we've got the increment operator which is represented by two plus symbols what that does it increases the value of a number or a variable for example if you've got a variable that has a value of seven and you want to increase that value to eight you use the call the variable name and then you add the plus plus symbol which is the increment operator and that will increase the value by one the opposite of that is the decrement operator which is used to decrease the value of a number or a variable by one so these are the basic arithmetic operators in javascript you also find that these are identical to most programming languages as well so i'm going to go over to my console and basically show you some basic examples open up google homepage and on the google homepage to access the console if you are on a windows computer you press control shift and j if you're on a mac you press command shift and j that will give you access to the console so i've got my console open and you should have this underline next to the world console so let me just run through the basic arithmetic operator the first i want to illustrate is a basic addition you may already know this already so do apologize if i'm going through this again so i'm just going to illustrate by adding two numbers together and i'm going to do two plus two and press enter and that will give you four next let me illustrate the subtraction i'm going to subtract two numbers also part four from two i'll press enter on my keyboard and that will return a value of two next i want to multiply two numbers so i'll do a seven and an asterix asterix is what you use to represent multiplication in javascript and i'm going to multiply seven by three i'll press enter that returns 21 next i'm going to illustrate a division example i'm going to divide two numbers so i'll divide eight by four and you represent division with the slash symbol press enter and that will return two next i want to illustrate the modulus operator modulus will only return the value of what is left after a division so i'll do five and the percent to represent modulus so i expect this to return one because two can only go into five twice and it should be remain the one you can see is returned one next i want to illustrate how the increment operator works first i'm going to declare variable called x i'm going to give it a value of seven so now if i call that value variable x it will return seven so if i want to change the value from seven to eight i can use the increment operator by just calling the variable by its name and doing plus plus twice and that will increase it if i now call the variable by its name it should now return a value of eight next i want to illustrate how the decrement operator works first i'm going to declare a variable called y i'm going to give it a value of five next if i call that variable it will return the five say for example i want to decrease it to four i'll just call the variable by its name and use the decrement operator which is two dashes press enter now if i call that variable y it will now show me a value of four so that's basically how the decrement operator works so these are just very basic examples to illustrate how the javascript arithmetic operators work thanks for watching bye for now hello and welcome to this video in this video i'll be introducing you to javascript operator precedence operator precedence basically describes the order in which operations are performed in an arithmetic expression the best way to show you this is by actually illustrating an example so i've got my console here so i'm going to create a variable so i'm going to create a variable called j you could call your variable anything i'm going to give it a value of 150 plus 70 and multiply by four this is going to be the value for my variable called j so if i press enter and try call this variable by name it's going to give me a value of 430 now if you use a calculator you get a different result so if you input 150 plus 70 times four on your calculator it will return a value of 880 the reason we get a different value here inside the console is that in programming and also in javascript there is a precedence of operators so what that basically means is that in terms of the order in which the operations are performed multiplication and division have a higher precedence than addition and subtraction that is why the multiplication is done first so it will do the 70 times four first before it adds the 150 so that is known as a precedence so the precedence is that where there is multiplication and division involved it will take higher order than where there is addition of subtraction involved so it does the multiplication first then the addition if there was division it will do that first and then the multiplication there is a precedence in the operator action however you can use parentheses to change that order if you wanted the addition to be done first all you need to do come here do a variable j and i'm going to set that to equals to i'll do a parenthesis i'm typing 150 plus 70 and i will close the parenthesis so what that does it will do the addition first because i've wrapped it around the parenthesis which gives it a higher order and then i can now do the multiplication so if i do this return this variable it will now give me a value of 880 because i have forced the addition to compute that operation first before the multiplication is done so i press enter if i call the variable j now i should get 880 which is the figure you will get if you had used a standard calculator but in programming and in javascript there is a precedence in the way the operator actions are performed so if you want a particular operator to compute its value first you need to wrap it around parenthesis and that will give it a higher order in the operator precedence so that's basically how operator precedent works thank you for watching bye for now hello and welcome in this video i'll be introducing you to the javascript comparison operators javascript comparison operators are used to compare values and will return a boolean result boolean basically means true or false so when you use javascript comparison operators it will always return either a true value or a false value so this is basic table illustrating some comparison operators so i'll start from the top which the first is known as the equal operator and it's represented with a double equal symbol so what that does it checks if values are equal okay so if you want to compare two values are equal you use the equal to operator if you want to check if values are equal both in value and data type you use this strictly equals two which is represented with a triple equal sign a single equal is used to assign a value so we must be careful between the distinction between single equals or double if you want to check if something is equal to something you use a double equals if you want to assign a value like you're doing variables you use just a single equal if you want to compare that the values are strictly equal in both data type and value you use the triple equal symbol if you want to check if values are not equal you use the exclamation mark and the equals to sign that will check if the values are not equal if you want to check if the values are strictly not equal in value and data type you use the exclamation and double equal symbol so if you want to check if your value is greater than another value you use the greater than sign for example you want to check if five is greater than two if you want to check if a value is less you use the less than symbol which checks if a number is less than another number of value you can also use the greater than or equal to which is represented by the greater than sign and the equals to sign what that does it checks if the values is greater than or equal to the less than or equal to is represented by the less than symbol and the equals to sign this checks if the value is less than or equal to so i'm going to jump into the console now and give you some basic examples of these comparison operators so when you're using comparison operators they will always return either a true or false result say for example if i want to check if four is equals to five that will return false because four is not equals to five if i want to check if a value is strictly equals in type and also in value so what i'll do first i'll create a variable called a variable called x i've given this a value of seven i'll create a variable called y and i'll give this a value of seven but the seven will be a string value so which means the data type is different from variable x so now i can do a comparison i can say x is equals to y this will return to true because both of them have a value of seven now if i use the triple equals to it will return to false because the data type is different but the value is the same so if i do x triple equals to y that will give me a result of false because they are not equal in data type the variable y has a data type of string you can tell because of the quotes that is enclosed around the value and variable x is numerical which has a value of seven so they are the same in value but not the same in data type so if you want to check if two values are the same for example if i say eight is not equal to seven that will return true because eight is bigger than seven so it is not equal to seven so if you want to check if a number is greater than another number you want to check if nine is greater than say eight that will evaluate to be true because nine is greater than eight if we say eight we call eight is less than say seven that again will evaluate to be true because eight is greater than seven so here i'm using the less than sign comparing if eight is less than seven that has returned false because eight is greater than seven if i was to say seven is less than eight that will evaluate to be true because seven is less than eight so let me create a couple of variables i create a variable a i give it a value of 17 and i use the comparison so if i say a is greater than or equals to 17 that will evaluate to be true because a the variable a here is 17 so i'm saying a is greater than or equal to 17 so that evaluates to be true if i create another variable say i create a variable b and assign it a value of 10 and i want to check comparison so if i say is variable b less than or equals to nine that will evaluate to be false because b is 10 so these are basic examples of comparison operators once you understand the basic concepts then you'll be easy for you to use the comparison operators that's it for this video thank you for watching bye for now hello and welcome in this video i'll be introducing you to the javascript logical operators the javascript logical operators are used to determine the logic between variables or values so this is a basic table that shows you two logical operators the first is called the ant and is represented by the ampersand symbol what that does it checks if all the conditions are met and it will return a boolean result either true or false if all the conditions are met it will return true if not it returns false the next is the or operator which is represented by the pipe symbol it checks if any condition has been met and it will return a true boolean result so the key distinction between the and and the or is that when you're using the and to check conditions all the conditions has to evaluate to true if they are not met then it will return a false boolean result boolean result basically means true or false in the or operator you only have to satisfy one condition it will return a true result so let me quickly illustrate how the logical operators are used in the console so i'm going to start by creating a couple of variables i'll create variable x i'll give it a value of seven i'll create another variable and i'm going to call this variable y and i'll give it a value of six now i can use the logical operators to check the condition so i can say x is less than 10 if x is less than 10 and y is greater than six this will evaluate to be false because the first condition is true x is less than 10 but second condition is false because y is not greater than six so it will evaluate to be false so if i use the or operator with the same condition it will return true because one part of the condition is true so it will return everything as true for example the same illustration if i come here and say x is less than 10 or y is greater than six this will evaluate to be true because the first part of the condition is true x is less than 10 so that's basically how you use a logical operator in a nutshell once you understand this basic use of it then it will be able to um it will make more sense when you start using it later thank you for watching and bye for now hello and welcome in this video i'll be introducing you to conditionals conditionals are code structures which allow you to test if an expression or a condition returns true or not they are used to perform different actions based on different conditions the common conditional statements are an if statement basically an if statement is used to specify a block of code that will be executed if a specified condition is true we also have an else statement basically that checks if the condition that is set within the if statement is true or false if that is false then the code inside the else block will execute so the else statement will only come into effect if the condition set within the if statement returns false so in my console i've got a variable here that i've defined called my number and i've given it a value of seven and i'm using an if statement which is a conditional statement to test a condition so i'm checking if the variable called my num is equals to seven if it is the code this code here will be executed which says console.log basically means it will print out this message inside this console it will say lucky seven if the condition is true but looking at the condition this condition is definitely true because the variable has a value of seven and i'm just checking here this is the condition the expression inside the if which is this here is the test okay so this uses the identity operator which is this equals to here to compare the value to compare if this value here is seven if it's equals to seven if it is it will print out that so i'm just going to press enter and it will print out lucky seven in the console so in this case the condition is true so no other code needs to be executed however you can also create a condition in which you add an else statement so that if the condition inside the if statement is wrong then a different block of code will execute which is located inside the else block so here i've got another variable same code my number i've changed the value to 10 and here i've included two statements the if statement and the else statement so what happens is the comparison is made the condition is tested and the test is inside the if block inside here so it's testing if this variable my number is equals to seven this will return force because the value is 10 so what happened this block of code here that says lucky seven will not run so it will not get executed because the value is wrong so what happens it will skip this block and it will execute this code because this condition inside the if is wrong it doesn't evaluate to 10 so once the comparison has been made it will run the code that matches the comparison so in this case the code inside the comparison is made inside the if block so it's tested the condition the condition has tested force because the value seven is not equals to seven so it's not equals to 10 so this block of code here that says lucky seven will not run instead it will run this inside the console anyway you see console.log means it's going to print a message inside the console so if i press enter you can see saying you're not very lucky today because this condition that we tested did not evaluate to true so this code here is executed instead so in a very simple example here to illustrate how the conditional statement works so there are other types of conditional statement but the very basic is the if and the else statement so the key thing to note here using the if and else statement is that the condition to be tested or the expression to be tested is always located in the if block so that's where you set the condition you can see here i've set the condition here so if that condition does not evaluate to be true then the block of code inside the if statement is skipped and the one in the else block is executed so in between the curly braces that's the opening curly braces and that's the closing curly braces is where you write the block of code that will execute you can see here this is the block for the if and in the f1 you've got the opening curly braces and the closing curly braces and in between you've got the code block that executes if the condition within the if statement or the if block is wrong so that's it i hope it makes sense if not please let me know thank you and bye for now hello and welcome in this video i will be introducing you to javascript functions functions are a way of packaging functionality that you wish to reuse so a function basically can refer to a block or a piece of code that is designed to perform a particular task a javascript function is executed when something invokes it by invoke i mean cause it so in order to activate a function after it has been created you need to invoke it or call it and usually you do that by its name javascript has many built-in functions that you can use a very popular one is the alert which enables you to create pop-up box messages javascript also enables you to create your own functions and the way you create your own functions in javascript is by using the function keyword functions often takes arguments arguments are bits of data that the functions need in order to perform or do their jobs and these arguments are placed inside parentheses which are separated by commas if there are more than one argument so inside my console i have created a function and the way you create a function you basically have to type in the keyword function followed by the name you want to call the function when you're creating function it's very nice to name your functions as closely as possible to the task that the function is meant to perform see my function i've called it add num which indicates that this function is going to be used to add numbers together so when you create a function you first of all have to type in the word function followed by a space then the name of the function and then you have to have parentheses sometimes the parentheses can be empty but you must have that in order to create a function and then if you've got any arguments you pass the argument inside the parentheses if there's more than one argument you separate them by a comma you can see here num one is an argument num two is referred to as an argument and once you specify the arguments if there are any inside the parentheses and then you have this curly braces you've got the opening curly braces here and the closing curly braces and inside in between the curly braces is the block of code that has to be executed when the function is invoked or called notice here i've also got a return statement here basically the return statement tells the browser to return the result variable out of the function so it is available to use all right this is necessary because variables defined inside functions are only available inside this function this is called variable scope so when you create the variables variables can be available throughout the application or throughout the scope which is known as global so if you create a variable and you declare it outside the function that makes that variable global that means you can use it anywhere within the block of code but if you define a variable inside a function like i've done here i've defined a variable called result and i've set that variable result to equals to whatever value is passed as number one and add added to value passed as number two so this variable is local to this function so it can only be accessed inside this function so when a variable exists inside a function once the function has been executed the variable basically is destroyed or you know it's it becomes on you can't use it again once the function has been called that's it is served this purpose however if you want the variable to be available you have to use the return statement that way it will tell the browser to return the result of the variable out of the function so that it is available to use you only do this for variables defined inside the function they are known as a local variable scope so variables defined outside the function are global so you can access them from anywhere within the within the javascript code whereas variables defined inside a function like i have done here i refer to as a local scope variable so here i have defined this variable called add num now to make or to invoke this function now that i've created it all i need to do is call the function by its name which is add num and then i have to you must add the parentheses and then i'm going to pass it two values because i've got two arguments there so if i say 10 comma 20 and i close the parentheses and i press enter that will add 10 and 20 together and give me 30 all right so anytime i want to use this function all i need to do is call the function by its name and then passing two arguments you can see it saves me having to rewrite the function again i've already written it defined it all i need to do is just call it i'm passing whatever arguments i need for the function so for example you can create the same thing maybe for multiplication or anything this is just a basic illustration to show you the importance of functions so you can create functions for different kind of tasks or to do different things but once you've created a function you don't have to write all the code again all you need to do is just call the function by its name and passing whatever arguments you need to do like i've passed in here and then you know the function executes if i want to add passing more argument i just call the function by its name and i'll pass in say i do six and six and that will add six and six together it will return 12 because i've already done written all the the functions here so all i need to do is call it by its name and passing the argument so that's basically how you create and use a function functions very powerful concept in javascript um i've only you know barely scratched the surface here this is just an introduction to javascript function there's a lot more to it so that's it for this video thank you for watching and bye for now hello and welcome in this video i'll be introducing you to javascript comments just like in html and css you can also add comments in your javascript code so this is the files we've been working on so far and on the course this is my javascript file you can see it's called myscript.js and there are two types of comments in javascript you've got the single line comments and we've got the multiple line comments i'll start with the single line comments so for example i've got this code here on line one if i want to comment that line of code out all i need to do is do two slashes and that will take that comment out you should comment out that line of code so you can see because i've commented out that line of code it has affected the text here that's been displayed all right so that is known as a single line comment comments are useful you can use them to troubleshoot different aspects of your code and more importantly you can use them to document what's going on in your code so that is a single line comment if you want to comment out multiple lines at the same time that is called a multiple line comment so what for example what i could do if i wanted to comment this entire code out for all these two lines you do a slash and then an asterix and then you do a asterix and a slash so that comments out everything on the code if i save that so if you can see the whole code has been commented out so this is known as a multiple line comment so if you want to comment out multiple lines this is how you do it you do you use the slash asterix then asterix slash that comments out everything within the opening slash and then this closing slash and the asterix so these are the two main types of comments a single line comment which is represented by two slashes on a single line and a multiple line comment i strongly encourage you to get into the habit of using comments to comment your code especially so when you write code always try to comment it or comment the areas you are likely to forget in future so that when someone else looks at your code or when you come back later to look at your code it makes sense to you because you've left a comment so that's it thank you for watching bye for now hello and welcome to this video in this video i'll be briefly explaining javascript linting tools what are javascript linting tools they are basically javascript code quality tools that enables you to check for errors or mistakes in your javascript code or script if you are using the brackets text editor it comes baked in with two javascript linting tools so it has js lint and es lint they are both baked into the brackets text editor so once if you've got the brackets editor installed you should have the js lint and es lint they both basically do the same thing they check for errors but they do it in different ways so they can check for things like syntax errors or if your javascript code is not valid it will highlight such errors so once you've got your javascript file populated i've got some code on it it is there behind the scene constantly scanning your javascript file for any errors and it will highlight them in the arrow window within brackets if you are a beginner programmer in javascript using linting tools will help you become a better programmer because it will help you catch a lot of common mistakes that will help you improve on your javascript code if you're using brackets you'll notice there will be an error screen here and normally you will have a warning so this warning basically will show you any errors you have or warnings warnings does not prevent your code from running it will still run it will just it's just highlights there are certain things that you could improve on it doesn't necessarily it's not a showstopper it will not prevent your code from working but it will help make your code more elegant so you can see here my es lint has identified a problem with my javascript code it's telling me here tells me line one which is just line one here it's telling me there's an error that the document is not defined basically what that means is that it does this document here has not been treated as a global object so it thinks this document is a local variable so with a global variable you can access it from anywhere within the file so it's thinking just lint is thinking that this document is not defined so the way around it is to make this a global object so that it can be accessed from anywhere within this page or document so the way we do that we just put a comment a javascript comment on the top of the file and what we do we just do slash and we do the word asterix i'm just typing the word global followed by the name of the document that is complaining about type document and we end it with an asterix and then the slash so that is a comment if we save that you can see the error has disappeared because it's now treating this document as a global object which means it can be accessed from anywhere within the file if you notice here if you're using bracket you can see here it says everything's okay no problem found so this is one place you need to check if there's any errors or any warnings it will be highlighted in this area here you can turn it off but i don't advise you do that so that you can capture any errors but if you want to turn it off go to the view tab and there's an option that says lint files on save just on check that but i don't advise you to do that's good you see whatever errors is captured so that you hello and welcome to this video i'll be introducing you to javascript events what are javascript events events are basically things that happens to html elements for interactivity to occur on a website events needs to happen to create that interaction an event can also be referred to as something that the web browser or the user does to create interactivity so you can look at events as code structures that listen for things happening in the browser and then respond into that by running a code so javascript will let you execute a code when an event is detected an example of an event could be when you click on a button or when you fill out a form on a website there are different types of events that cannot occur the most obvious event example is known as a click event basically this is fired by the web browser when you click on something with your mouse so to demonstrate how this works i've already entered some code in my console in some google homepage console here so got the document dot query selector the document dot query selector returns the first element within the document that matches the specified selector so here i've passed in the html as the specified selector which is the entire document this document here is known as the html and next i've attached an on click property so after the selector i've put a dot and then on click on click property basically is going to return the click event handler for the current element a handler basically is a function that is invoked or called by an event listener an event listener is a kind of function that waits for an event to occur then it responds with a code it then executes some code in response to that event so in here in my document dot query selector i've selected the html document as a selector which so this is where the event is going to be executed on and i've attached this on click property so and next to that i've set this to equals to a function you can see i've got a function that's opening curly braces and this is the closing curly braces when you define a function you define it like this with parentheses parentheses can be empty if you've got nothing to pass in as arguments and in between the curly braces will contain the block of code that will execute in response to an event so here the property here this code on click will be the event so what this is saying is that if i click anywhere inside this called this browser area it will execute this code ouch stop poking me so if i press enter on that now so it has now saved us so if i click here you can see saying ouch stop poking me so me clicking in that area is an event and by clicking on it it also runs or executes a corresponding code that responds to that event so if i click again it execute this code here which is responding to the click event clicking is an event in the browser so by me clicking it execute this code which is this code here it says ouch stop poking me i'm just going to click to exit that this is just one event i've just illustrated there are tons and tons of events that can happen within the browser and you have to also define the corresponding code that will respond to that event there are many ways to attach an event to an element so here i've only used one which i've attached the event to the html element which is this actual page and here i've also set the onclick handler property this is a property i've set that to equals to an anonymous function if you notice i've declared a function but i didn't give the function a name that is referred to as anonymous so i've assigned that to a nameless function which contains the code we want the click event to run so this is a code i want the click event to run when i click on the html which is the browser here it will execute that code so this is just a very basic introduction to events there are several tons of events that can happen in a browser and you can also have corresponding code you want to execute in response to an event so that's it for this video thank you for watching and bye for now hello and welcome in this video we are going to add some more functionality to our example website now that we have explored a little bit about some javascript basics so this is what the sample website looks like at the moment so what i'm trying to achieve here is incorporate an image changer at the moment i've only got one image i want to try and add another image so that when i click on this image here it will change to another image that's what i'm trying to achieve so first of all you need another image in your image folder if you've only got one image make sure you add more i've got a few images in my images folder here notice i've got one two three four but you only need another one just so that you can follow along with this example so make sure you add another image to your image images folder you should have an images folder so add another image make sure that the image is the same size all the images has to be the same size if possible i've already showed you earlier in the course how to resize your image so if you're not too sure if you could refer to the video on that and just try and resize your images to be the same size and once you've got the image save it inside the same images folder any code you have in your javascript file at the moment you can delete it if you want to keep the one we've already done it's up to you if you want to do that but for me i'm going to just delete what i currently have here when you are using the brackets folder anytime you make changes to your javascript file it doesn't automatically reflect as you can see here you can see this dot next to the live preview is basically telling you you need to save whatever changes you've done the only thing that trying that basically changes automatically is your html and css javascript you have to save it first and the way you identify that is by this little dot so if i save this here the title should change i'm just going to click file and save you can see my title has now changed i have added some bunch of code here to my javascript file so i'm just going to explain the code to you line by line if you notice here we've got some errors here js lint has 10 these are not errors they are warning so if it's yellow it's warning but if you notice here i've got an error which is the same document is not defined this is basically because it doesn't recognize your document as a global variable it thinks this it thinks we're using something that's not being defined so the way to get around that is just to put a comment so you do a slash and the comment and just type in global followed by the word document and then an asterix and then slash and save that anytime you see a dot next to the live preview means you have to save the changes you've made before it takes effect you can see now that error has disappeared but we've still got some warnings which we will address later anytime you have warnings warnings does not stop your code from running it just means there are some problems that it wants you to address so we'll address them later let me walk you through the code first line one already covered line one as we've put a comment here and inside the comment we put global document which makes it possible to access this document from anywhere within this page or this file here line three i have defined a variable called dog image and i've set that to equals to the document or query selector we touched on query selector briefly when we're exploring javascript and the selector here is the image so this is the target so i'm using the img stands for image i'm using the img element as the selector line five i've created this dog image here this variable called dog image i've attached an onclick property to it and i have set that to equals to an anonymous function anonymous function basically is a function that hasn't got a name it's a nameless function and inside the anonymous function i've got my opening curly brace and my closing curly brace in between the curly braces is the block of code that will execute based on the condition so i am storing the reference to my img element in my variable in this variable called dog image that's where i'm storing all the reference to anything that's called img so any img element is stored in this dog image variable and i have set the this variable here i have set these variables on click handler property okay this on click is a handler i've set that to equals to this anonymous function so every time that the element is clicked so this is the element which is the image anytime the element is clicked it will trigger the block of code inside it so this is the condition it's checking for online seven is saying if this variable called my images online six i defined another variable called my images and i set that to equals to this dog image variable and i attached a get attribute property to it and the get attribute property i'm attaching to it is the source source basically means it will grab the image from the location you have stored it line seven i'm saying if notice i'm using triple equals to when you triple equals to it will check the condition both the value and data type is so it's going to check if this variable called my images is strictly equals to the images which is this images folder here i've got slash poppy.jpg which is this current image if it's equals to that so i'm saying that if it's equals to that if this condition matches then i am changing the attribute on the dog image variable so i'm saying if this condition is true change the image to this image here so if i click on this now it should change the image this is change the image because this first condition is true if not changes it swaps the images over now it's saying if it is not true which is where the else conditional statement comes in then change the variable again to this so what it's saying is that if i click on this then this condition in the if block is no longer true then it will now execute this code so if i click on this it will return the original image so that's basically how i'm changing the images from this block of code hello and welcome in this video i'll be walking you through fixing the js lint warning messages that were generated when we added an image changer to our javascript code so these are the warnings at the moment we've got 10 js lint problems they're only warnings warnings do not prevent the code from working it just there's just some warnings in terms of suggestions as to how to properly write your code so you're basically not happy about the way i've written the code so let's try and go through them i've got 10 in total so i'll start with here it says line 5 which is here it's saying expected exactly one space between the function and the parentheses okay between the function and so it's talking about here it's telling me i should give a space all right so i tab some people don't like writing functions like that they like to have the parentheses close to the function but i'm going to save that and save that will disappear i'll click save okay it's happy with that that has disappeared so we've got nine left so online six year is complaining that i'm missing a use strict statement the strict statement basically helps prevent certain actions from being taken or thrown into error so it tries to catch some common errors so let's try and follow what it's complaining about so line six so i'm just going to come here and add the strict statement so the way you do that is just to single quotes and you type in use space strict and you end it with a semicolon all right let's save that solves it so i'm going to save that okay it's not happy about that in fact it's giving me one more error so i've definitely done something wrong there it's not happy about all right you can see here is saying that it's expecting me to use this statement at column five not column one so if you look in my code editor i've got it online six column 13 so i need to shift it to column five so let's try and shift that to column five alternatively i can move it to a separate line on its own let's see if that works so it's not happy because it's saying you expect it to be a column five not column one so let me move it to column five if you look down here as i'm moving it it tells you the column so if i shift it that's two three four five so let's save this see if it's happy all right it's happy about that so line six unexpected space okay you're saying i've got some space you can see here it says use strict so there shouldn't be any spaces so the space is complain about you can see where the mouse is where the cursor is flashing so i've tapped to reduce that space that's basically what's complain about so we now have eight errors line eight it's saying expected exactly one space between if and and so line eight so expected one space between if here and the parentheses all right so that's a if let's do a space again not everyone likes writing code this way but this is what it's suggesting so let me save that all right so it seems to like that so i've got seven left so let's go to the next one line nine expected dog image at column nine not column seven okay yeah okay so it should be a column nine not seven okay so let's move it that's eight you can see may says eight there so if i tab again that's nine because it's trying to create a proper indentation so it's quite useful because it enables you to get into the habit of writing code properly all right so we've down to six line nine unexpected space between set attribute and the parentheses line nine set attribute okay unexpected space so i'll just tab reduce by one let's save that it's happy five more missing space between and and images line nine between between and all right between the quotes and the images okay line nine between the quotes and the images in one space is really fussy this guy okay let's save that see if he likes that it does okay we'll go four more line 11 it's saying expected this variable to be a column nine not seven okay so line 11 let's tab that's eight nine because it makes sense because it's trying to create proper indentation if i save that that's good we're getting there three left hello and welcome to the part two of fixing js lint warnings so we initially had 10 arrows showing up in our js lint console we've got it down to three so online 11 is complaining that there is an unexpected space between the set attribute and the parentheses so this is what it's complaining about so we just need to tab and reduce the space and then save that all right so it's happy with that next a saying here missing space between the quotes and the image here okay so it's missing a space between the quotes and the image so it's expecting a space here okay let's try that and see if he likes that click save all oh no it doesn't like it that's not what it means okay let's try here to a space and do a save yep that's what it's complaining about wanted the space between here and there so finally got it down to the last warning line 13 so it's expecting a semicolon but instead it's all that so let's add a semicolon and see if he likes that so looks like it is happy with the semicolon you can see here my console arrow console is clean you can see it says no problem found good job so once you see this green tick it means your code is okay linking tools are very useful because they help you become a better programmer it makes you structure your code in such a way that it's easier to read and understand so following the warnings that the js link provided you can see that the code is in a much better structure than it was prior to the changes that are made following the advice from the js lint tool so anytime you're writing javascript code always look out for the warning errors here and if there are any just as much as possible to just follow the suggestion or what it's complaining about so that's it for this video thank you so much bye for now hello and welcome in this video i'll be showing you how to add a personalized welcome message to your website so this is what the website looks like at the moment so the goal here is that when someone first visits the website we want it to be a prompt where it will ask the user for their name once they enter their name it would then say rather than saying hello what you say hello world followed by the name of the person who entered the name the first thing we want to do is go into our index dot html file and i'm going to add a button so the button eventually when i program it will enable a user to change the name that is displayed on the welcome greeting so if you scroll down to the bottom of your html file just before the script tag just before the script tag here after the paragraph tag if you just enter a button the reason the script has to be at the bottom is to enable all the content all the other content to load before any script is executed so that there is no interference so here i'm just going to tap and create a button the way you create a button you do a less than sign type in button and a greater than sign and then just type in the text you want to show in the button i'll just say change change name all right so that the wall will appear on the button and then you save that click save you can see it has appeared here with this live preview any changes you make if it's html and css it appears instantly but if it's javascript you'll have to save it first before it reflects on the page i have added some more javascript code i started by modifying line one of the code the global comment i have included inside the global comment a window object and a local storage api reference so they will be available anywhere in the javascript file without including them in the global statement above the document it will not be available throughout the file it will create errors the window inside the global comment online one basically refers to a window object all web browsers supports the window object the window object represents the browser's window and all global javascript objects functions and variables automatically becomes members of the window object i've also added the local storage local storage allows you to save a tiny piece of data inside the web browser while the session is opened and also will retain that data even when you close the web browser and reopen it later at a later stage i added a comment on line three to indicate the code i used for the image changer the rest of the code i have added was from line 17 to line 37 so these are these are the new block of code from line 17 to 37 line 17 is just a comment to indicate where the code for the welcome message starts from line 19 is a variable that will store any references to the button element i created earlier in my html file line 20 is another variable that will store any references to the h1 heading element line 22 i have created a function called set username all functions should have parentheses the parentheses can be empty or you can pass in arguments into the parentheses and also functions should also have an opening and closing curly braces so this is my opening curly braces and that is my closing for this function so everything all the code within this block here will be executed when the function is called line 23 i have specified a strict mode inside the function strict mode basically is a way to introduce better error checking into your code so you can catch any errors the function contains a prompt so i've got a prompt here i've used a window because the prompt is a member of the window object which i defined here so i'm referencing i have to put a window before the prompt in order to call it to work so here i've created a variable called my name and i've set that to the windows.prompt and here is a message that will pop up when the visitor gets the prompt the prompt is a dialog box it's a bit like an alert box but the prompt will ask a user to enter some data storing and then it will store the data in this variable i've created call my name so when the prompt comes up it will prompt the user say please enter your name once the user enters the name and once they press okay at the dialog box it will then store that name they've entered in here it will store it in this variable called my name next online 25 here i'm making a reference call to the local storage local storage is an api api stands for application programming interface the local storage is going to allow us to store the data in the browser and later retrieve that data so the name that the user gets from the prompt that prompt is stored in the in this variable and that variable will store it inside this local storage which is located inside the web browser okay and we're using the set item here the set item function which is this one here to create and store a data item called name and we're setting its value to the my name variable which is this variable here the my name variable will contain the data the user would have entered from the prompt finally here we've got the text content of the heading so it's going to change so once the user stores the name inside the local storage the h1 heading title will then change to say have a nice day plus whatever name the users entered this my name here refers to this variable here so whatever variable or name the user entered from this prompt will be displayed here you can see my example here i've got my name here it says have a nice day rick so once you've entered the name it changes the title of the h1 tag to have a nice day plus whatever name you've entered in the prompt next i've got an if block here so we can see we've got some conditional statement online 28 to 30 here we've got the if block so i'm checking some conditions here so i'm saying if this local storage if it is not this exclamation means not if the local storage is not doesn't have any details that if there's not installed in the local storage we're telling it to set the username so it's going to call this function here and set the name so it basically is checking if the data exists and if the data does not exist we're using the set username function and that function will be called and it will then execute and create the name so that's the condition there so it's saying if it does not if it is not set it will set it if it is already set if it exists the user that is if the user has already set it during a previous visit we will then retrieve the stored name using the get item we're now going to retrieve if the name has already been stored we're going to retrieve it using this get item function and we're passing the name here whatever name was stored we're going to retrieve that from the browser and then display the heading we're going to change the title to this to say have a nice a plus whatever name that was stored in the web browser finally here at the bottom here from line 34 this block of code here from 34 to 37 is referring to this button here this button you can see here the change name button so basically what I'm doing here is that I'm attaching an on click event handler this is the on click event handler I'm attaching that to this button here so when the button is clicked the set username function is run so if I click on this button now it will call this function and prompt me for a name so let me do that so that you can see it in action let me bring this here a bit so if I click change name it will give me a prompt so if I change this to say john and say okay it will now say if I browse you can see you can say have a nice day john so that's basically how that button works this button yet so if you want to change the name that is displayed yeah you just click on this and it will trigger once you click on this that's known as an event if you click on this it will trigger this function and this function will call this it will call this here this set username which is this function here and to trigger the whole process again to check if you've got the name saved in the browser storage if it's not saved then it will create it so that's basically why the if and else statement is there if it's there if it doesn't exist it will create it using the set username function if it does exist it will retrieve it using the get item method method and function they kind of work in the same way so you may have heard me hear me use function or method I mean the same thing so the website is basically finished so the way this is going to work is that when a visitor first visits this page it will ask them it will prompt them for a name it will ask you for your username when you give your when you enter a username it will then personalize the message you just say you know have a nice day john or whatever name you have entered but you can also change it by clicking on this button here which will trigger the event and it will set this block of code in motion one good thing about the local storage is that even when you close the web browser and you reopen it for example now I've stole the name john if I close my web browser and reopen it it will still retain that name so let me close my web browser and I'll show you what I mean I'll exit this page I'll launch it again and it should still retain the name john that was safe it says to go john safe so that's possible because of the local storage facility in the web browser also make sure your code is well indented exactly the way I've done mine so that you don't see any unexpected and expected lint errors you should have this green tick which indicates that everything is okay with your code so that's basically it for our sample test website project so you should have a website looking like this you should be able to click on your image and it should change and this button also should change when you click on it it should prompt you to change or to add a name okay the reason is called null here is because I didn't enter a name so if I enter a name so let's say let's say call it toning you see it says have a nice day toning so the next time I relaunch the web browser it will still have that name saved until I change it so that's basically it thank you for watching and bye for


Hi guys, I hope you had an amazing, amazing Christmas holidays, however you celebrate it. I hope your holidays was amazing. I feel like I haven't been on here in eons because I think my last video that I had published was like, I think I filmed it like a week before or the weekend before Christmas and I wasn't too sure how Christmas was going to go and I wasn't too sure if Jane and I were going to go away. It has been an emotional roller coaster for me since October and you know, it's hard sometimes to keep everything together when life is just throwing you all sorts of different curves. But anyways, I'm going to quickly just tell you a little bit about the holidays because Christmas was extra special for me. We were able to get my dad up to my sisters. I started to do a vlog on it and then I decided not to publish the vlog because you know, my vlogs are just vlogs, you know, they're not all that terribly interesting to most people. So I decided not to not to publish it, but Jane, I got my dad in the car and my mom and I in the back seat and my dad and Jane in the front seat and we drove up to my sister Heidi's and my dad had a wonderful day.  You can see the family and our annual tradition of our Christmas hat family photos. And this year we had everyone except for my niece and her husband and her daughter because they moved to Florida. So we had everyone else in the photos and it was just really, it was just really special. It was really special. My dad's not doing too well but he really wanted to get up to Christmas and be there and enjoy it and you can see from the photos and this one particular photo shows my dad and my niece's baby son who's going to be a year old soon and it shows the difference in the generation, 90 years between the two of them and it's just amazing. It was amazing. But anyways Christmas was overall wonderful, wonderful. We came home, got my mom and dad settled at the house, came back and our plans were to leave the very next day to go down to Newport Road Island and we did. We stayed in an Airbnb in Newport Road Island and we had friends with us. There's a three rented, a three bedroom Airbnb and it's just one bath, can you believe it or not? Thank God for Poo-Poo-Ree, oh my gosh, I brought that. I showed them all how to use it and it was really, even though one bath we did really well. We did all the Newport mansions, I'll insert some pictures here and then at one night Jay and I walked around, this was the first night Jay and I walked around on our own and the second night when they arrived we all went back down to Newport and it's just beautiful. And we just had a beautiful weekend so as the pictures can tell we love Newport if you've never been, it's a seaport and it's just beautiful because they have the mansions and you can read or hear all about them and the mansions, some of the mansions are open and they're decked out for the holidays and some of them have decorations that were true to the time era that the mansions were being used. So it was a wonderful weekend. We came home Sunday and my dad had gotten sick. So that was sort of a little dampener on Sunday but all ended up well. He's holding his own, he's doing good, he's at home and he's in good spirits. And then we had a snowstorm and I wanted to get this published. I couldn't get it done for Sunday night. I don't really know if I'm going to get it today but I wanted to get this video up so you could see and I could share a couple of products with you. The first product I want to share with you is this and I was thinking how am I going to make, you know, how is this going to work but this is the Irresistible Me Black Diamond Professional Hair Straightener and this is from Irresistible Me. I've had a couple of other flat eyes, some that was sent to me for review and one of the things that I found difficult was the adjustments oftentimes were on the outside and you would hit it when you would hold this and the next thing you knew you were increasing the heat.  It heats up, it holds it there, you've got this really nice barrel here and you can press here.   I've done it with extensions, I've done it with my own hair, I've done it with a topper and any, basically if you're looking at, if you have a wig or anything like that or the hair extensions if they're the human hair, they're temperature-friendly, you can do this. This is really amazing. No more getting stuck when your cords wrap up on you. So this is a super cool device. I really like it. This was sent to me complimentary. If I'm here resistably me, I don't get paid to do this. I don't get a commission off of the sales or anything of that nature. If I did, I would disclose it but I did get the product free and I have used it. I've used it for, oh gosh, four or five weeks now and I really like it. It's very comfortable in the hand. That's the most important thing. I didn't find it awkward to use and it does a great job on my hair extensions, on my hair. It does a really great job and I love the fact that I can't accidentally get the temperature control. No, that makes a big difference. So thank you so much and this is on sale by the way guys if you go to their website, here's the top of me, I'll link it below. This is on sale. It's a really good buy, I believe. So I really love this. This worked great on my hair and my daughter-in-law has curly hair. I'm gonna let her try it and see how it works on hers. I think it's gonna be beautiful. I've mentioned Julia before and they had sent me a couple of pieces. They sent me this. You can see it and the other one that they sent me is very very much looks like my wedding band. In fact, when I worn this, my mother who is extremely fussy has not been able to tell that I'm not wearing my wedding band. She's not been able to tell. So anyways, what I wanted to tell you is because I've had so many of you ask me how am I liking it? How are they holding up? I will tell you that I think these have held up amazing. I've actually had these in water. I've washed my hands with them. I've worn them out. I take them on trips when I go away and I leave my good jewelry at home and I have this with me. So while this was sent to me complimentary, I have to tell you they've held up really well and that's the question that many of you have asked. How have they held up? It's been it's been a couple of months. So to me they're just absolutely beautiful. Now it kind of feels like saying oh my gosh she's showing all these things that she received in the mail but I did. I got a PR package. Now many of you know I like Jen Amber's product. I have used her derma rollers in the past that her aqua stamp. Well I got this in the mail and she sent me a couple of more of the eye patches. I really like these eye patches.  I use a lot of her products. Anyways I haven't even opened this up yet. I got two derma rollers and I am going to derma roll my scalp again. I haven't derma rolled my scalp in quite a while and I used to derma roll my scalp all the time. Her derma rollers are medical grade needles and I think there is a big difference between a medical grade. What is this? Sheet masks. You guys know I'm in love with masks. Sheet masks. Oh yes. Oh my gosh. So sheet masks. Oh wow. I love sheet masks. I have been using her eye masks and what I've been doing with these, sometimes I put them on my 11's actually. I know that sounds weird and sometimes I put it on my deep, what you might call it, lines here. Marinette lines. I don't know. And then other times I go right down here. I have a lot of loose, flabby skin under my eyes so I don't like to really pull too much on that. So I use this in other spots and then sheet mask. I'm a sheet mask queen. I love these. Thank you so much, Jin. I will tell you exactly how I like them and I will also let you know exactly what my process is going to be. I have to find out what this says because I think the one I want is the 0.75 for my hair and I don't know whether or not. This is the 0.25 and this is the 0.75. So I'm going to start doing, I'm going to start doing my scalp. I'm probably going to do it once or twice a month at this point in time. I'm really not too sure but yeah. Thank you so much, Jin. And then I also got a gift in the mail. I got several gifts in the mail from Christine from the UK. She sent me some number seven. I've not tried this number seven and at the time that she had reached out to me about this, it wasn't, we didn't have this in the States. I don't know if it's in the States now or not but Hydro Luminous Moisturizing Foundation. This is in the color wheat. That's the color I wear. It's an SPF 15. It's a medium coverage and it's suitable for sensitive skin. She also sent the primer and sort of the foundation and then she said the, this I think is cool, little shadow. So I haven't used any of it yet but I will use it. So I was, I thought that was an amazing, amazing gift. I really, really like that. I've also received gifts from Sheila and from Marlene Fab and Glam. And I know I've shown those in the past but it will tell you that I've gotten a lot more daring with my eyeshadow than I ever have in the past. I actually went out and I bought myself a, a Urban Decay Naked 3. Now I had the original Smoky from Eons ago but some of you remember when I first tried to put it on, I was like, I looked horrible. I looked like a clown. I just couldn't make it work. It was too pigmented and over the course of these last two years my skills have improved slightly, not a whole lot. So now I'm using that palette and I actually love it. I'm thinking wow. So on my eyes today it's a combination of the Urban Decay Smoky and the Urban Decay Naked 3. Like I said, when I first started to use the Smoky I just could not make it work. It was too dark. It was too pigmented. Now I'm like, ah, I need to have a darker shade than this has. Now these shades are beautiful. They're right up my alley. This was highly recommended by Marlene Fab and Glam but the darker shade in here is now at the stage of not dark enough. So I did a combination of the Smoky and the Urban Decay 3. So I did that but most days during the week I've been using this palette from Too Faced during the week. It's given me a good combination of different colors that I really, really like. So I've been using that during the week and I'm thinking to myself you're becoming a palette addict because I'm looking at it and I'm like oh my gosh I have all these palettes like holy mackerel. This is adorable. This was also a gift. This was from Sheila and this is the one that I bought that these colors. I know I've shown these colors before. So I'm thinking well if I go away, you know what I like a lot about these is I really, really like the blues and the purples a lot and I also think the presentation is super pretty. I think this is a sexy looking palette. So anyways guys I just wanted to share those. Oh and because I am trying a new foundation I actually talked about this on my Insta Story a lot and so this new foundation Peach Perfect. Peach Perfect. This is from Too Faced. Now it isn't born this way. I think born this way is the next foundation I'm gonna get but I actually got this and I think it's called Warm Beige. It comes out looking a little bit more you're not gonna be able to see it. It comes out looking a little bit more yellowish when I first put it on my skin but then I kind of blend it in and it doesn't look yellow at all and that's what the foundation I have on today.  So I think that's a scoop. Anyways guys please please please I hope you all have a safe and wonderful New Year's. It is snowing here. Happy New Year. Hi honey. Hey. Hey did you like that blonde wig I showed you a little bit ago? Yeah I kind of grown on me. Anyways you guys all have a very safe New Year's and I hope you all have the most amazing 2020. I wish you health, happiness, prosperity but obviously the most important thing is health and same for all your loved ones. So thank you all so much for being so supportive throughout the year. I don't know what I would do without you guys watching because why would I be making videos if nobody was watching. So thank you thank you and thank you Irresistible Me for sending me this flat eye and really easy to use and Jen Amber for all these awesome awesome face masks. Dermarola. Yes I'm gonna be starting that whole thing over and I'm gonna share my journey with you. So 2020 back to Dermarola rolling the scalp because I think it made a difference when I was consistently doing it and I kind of fell off the the wagon. I also fell off the wagon diet wise to getting back on that wagon. Bye guys.


Dear students, let me present to you the CDF of the discrete uniform distribution and let me do this with the help of an example. Suppose that we are rolling one fair die one time and we want to have the CDF of the distribution in front of us in the mathematical form, algebraic form and also we would like to draw the graph of the CDF. All right, so how do we start? Subsepele pehla column X, what are the possible values of X? It represents the number of dots on the uppermost face of the die when we roll it. So then obviously X's values they will be 1, 2, 3, 4, 5 and 6. After that second column probabilities since it is a fair die therefore 1 by 6, 1 by 6 so on all of them 1 by 6. Now for the CDF cumulative distribution function, what do we have to do? We have to construct one more column and this is the column of cumulative probabilities. Here I avoid writing capital F of X because it has a reason which I will share with you later. In this place its heading I would like to write cumulative probability, so what is its procedure? Just like you do cumulative frequency, the first value as it is and then the result plus the next value and then the result plus the next exactly we will do here. So the first probability as it is 1 by 6 and then 1 by 6 plus 1 by 6 gives us 2 by 6, 2 by 6 plus 1 by 6 gives us 3 by 6 and we go on like that. So the last one is 6 by 6, i.e. 1. Now these cumulative probabilities have come, we have to use them in order to write the CDF in its proper form. What you now see on the screen is very very important and I would like to request you to pay a lot of attention to it. Take a look at the first value that is written there that is 0 and the last value that is 1. Note that it would always start from 0 and go up to 1. The second thing is to note that the portion of the x axis written against 0 that starts from minus infinity and note that the portion of 1 against x axis that ends at plus infinity. So here the message for you is that whenever you write the CDF, you have to exhaust the entire x axis. It should always always start from minus infinity and go up to plus infinity. All right, if this is clear, then look carefully at it. Now I would like to tell you to look at the cumulative probability written below 0. When we did that step a little while ago, we said first value as it is, then you can see that below 0 that first value is written. 1 by 6, below that 2 by 6, 3 by 6 and so on until we get 6 by 6, i.e. 1. After this, note that the 1 by 6, 1 by 6 that is written against the x axis, which portion is written in front of it. Note that we are writing 1 less than or equal to x less than 2. It is very, very important that you note that the 1st value has equal sign and the 2nd value has no equal sign. The 2 by 6 below that is 2 less than or equal to x less than 3 and the next one is 3 less than or equal to x less than 4 and so on until we get 6 less than or equal to x less than infinity. Now I will tell you why this is. Now you will say that I left the first 0 deliberately and now obviously I will come towards it because I have to think about that part as importantly as any other part. Now when we wrote 1 by 6, 1 less than or equal to x, then the one above that is 1. We cannot include 1 in that because 1 is included in the lower part. So the one above that will be exactly as you see on the screen, minus infinity less than x less than 1. This is how it is completed, everything is covered up to minus infinity to infinity. Before I tell you the reasons which I want to tell you. I would like you to look at the graph of this particular cumulative distribution function. Do you not see that it is a beautiful staircase type graph where the steps are rising by equal height and also the length or the width of the step all of them they are the same except the first one which starts from minus infinity and the last one which goes up to plus infinity. So it is a beautiful step function, a technical term here, it is a step function and from the basic rules pertaining to discrete probability distributions, you already know that the graph of the CDF of any discrete distribution would be a step function. It would start from level 0. It would rise up to level 1, but the important thing is to note that the more symmetry and beauty is seen in the graph of the discrete uniform distribution of the CDF, the rest will not be like this, the rest will be that the height will not be the jump at any other place and similarly its weight that can also be different. But for the discrete uniform distribution, it takes this beautiful pattern. Now the last thing that I would like to explain which must be in your mind is that thing about putting the equal sign before the X and putting not putting the equal sign after the X. We have to consider the probability of getting one on the uppermost face of the die is equal to 1 by 6 and after that when we said that the probability of getting two on the uppermost face of the die is also 1 by 6, so the concept of cumulative is that what is the probability of getting either a one or a two when we throw this die? What is the probability of getting either a one or a two if we throw this die only one time? Well, students, that probability is 2 by 6 obviously, because if we look at it from the classical definition itself that there are six possible faces, two of them are favourable that either one comes or two comes, so then that favourable over the total 2 by 6, the CDF in front of us is 2 by 6 against the value of X which is written as 2 less than equal to X less than 3, so that 2 is in it, but 3 is not in it because if this question is asked what is the probability of getting either a one or a two or a three when throwing one die, so its answer is 3 by 6, so the next 3 by 6 is written against the values of X, where 3 less than equal to X is in it, so this is the fundamental way of interpreting any CDF, so if you focus on it carefully, then you will realise that this is exactly the correct way of writing it, if I write it against the values of X, then I am saying that the probability of getting either a two or a one is 1 by 6, so that is not correct, 2 or 1, 1 or 2 is the probability of getting either a one or a two or a two, so the probability of getting either a one or a two or a two is 2 by 6, so the two by 6 is written as 1 by 6, so the probability of getting either a one or a two or a two is 1 by 6, so the probability of getting either a one or a two or a two is 1 by 6, so that is not correct, it is 1 by 6, that X will be anywhere between 1 and 1.99999, the jump that it takes is on 2, it does not take 2 from the beginning, in its graphical version, now I will tell you in the end that whatever I said, look at it carefully and focus on it, try to understand this with reference to the graph, i.e. both complement each other, the graph does not take place unless you write this and it understands better if you look at the graph, all the best.