Let me comment everything here and let's say that we are creating a variable day and the day is two. Then we have a break to break out of that particular statement. It takes an expression and based on the cases, it executes some piece of code. You can see we are using a bunch of statements that is switch, case, break, all these things. The switch statement in JavaScript is another type of conditional statement that allows you to test a variable against a series of values and execute different blocks of code depending upon the match. If the condition is false, the code inside the curly brackets of the else condition is being logged to the console. If the condition is true, it executes the code inside these curly brackets that follow the if statement. In this example, this if statement checks whether the value of the age variable is greater than or equal to 18. But if I make it less than 18, let say 10 or something, now if I run this program, you will see that the output is, you are not yet an adult. If I try to run this program, you can see that it prints you are an adult. As you can see, the variable age is 18 that means it is coming under the if condition. You can just use if condition but else is used to handle age cases more easily. One thing is to notice that this else condition is an optional. Then I will just have a else condition, else console.log I can say you are not yet an adult. I want to say if age is greater than equal to 18, then I will open up those curly brackets and I'll just print out console.log. Here what I will do is, I'll just create a variable let's say age, and let's make it 18. Now, let's also see an example here to understand if and else condition. Let's look at the syntax for if/else statement in JavaScript. If else statements allows you to execute different blocks of code depending on whether a condition is true or false. The two most common condition statements in JavaScript are if/else and such cases. In JavaScript conditions statements are allowed to perform different actions based on different conditions. Now in this video, we will learn conditional statements in JavaScript. In the previous video, we learned string manipulation. You will learn how to set up a React project, create components, and manage state in your application.īy the end of this course, you will have a solid understanding of frontend development principles and how to use React to build interactive and dynamic web applications. In the third module, React for Frontend Development, you will dive into React, a popular JavaScript library for building user interfaces. You will learn about variables, data types, control structures, functions, and more. The second module, Introduction to JavaScript Programming, will teach you the fundamentals of JavaScript, the programming language that powers interactive web applications. You will learn how to structure content with HTML and apply styles to your web pages with CSS. The first module, Introduction to HTML & CSS, will introduce you to the basics of HTML and CSS, which are the building blocks of web development. The course is best suitable for people with familiarity with web development. Welcome to the Frontend Development using React course! In this program, you will learn the fundamentals of frontend development and how to build web applications using the React library.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |