0%
Loading ...

Parvesh Sandila

Parvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master's degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​

Functions in JavaScript

In this tutorial, we will learn the Functions in JavaScript. Main purpose to use function is to reuse the code. For example, you have a large program where you want to perform the sum of two number multiple times. You can do this with the help of function without writing the same piece of code multiple times. Functions help us to divide the big program into pieces. It is easy to manage a small piece of code instead of a big program. There are also a lot of inbuilt functions like alert() or write(). As we know we use these function several times but they are defined only once in core JavaScript. We will learn four things in these tutorials. Function Destination Calling a function Functions with parameters Return Statement of Functions Function Destination: It is obvious if we want to use a function then we first have to define those functions. It is so easy to define a function in JavaScript. You just need to function keyword then write function name. You can also write parameters if that is the requirement of your function. Now we will check a simple example if JavaScript function <script> function show() { alert(“Hello This show Method”); } </script>   Calling a function: In the last example, we saw how we can define a function in our code. Now the second step after creating a function is how to call these functions. Calling a function is so easy you just need to write the function name followed by parentheses where you want to call that function. <script> function show() { document.write (“Hello This show Method”); } </script> <form> <input type=”button” onclick=”show()” value=”Call show Method”> </form>   Functions with parameters:  Till now we learnt how we can create a function and how we can call that function. But showtimes we also want to send data to function when we call that function and we want the function to process that data which we sent while the call to that function. So to do this we define parameter functions is our code. Check this Example of Parameter functions. <script> function add(num1, num2) { document.write (“Sum =”+ (num1+num2) ); } </script> <form> <input type=”button” onclick=”add(10, 15)” value=”Show Sum”> </form>   Return Statement of Functions: In many situations, we need our functions should return some value after completing the whole process in function in that kind of situations we use the return statement. <script> function add(num1, num2) { var sum; sum = num1 + num2; return sum; } function show() { var result; result = add(15,20); document.write (result ); } </script> <form> <input type=”button” onclick=”show()” value=”Show Sum”> </form>   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Functions in JavaScript Read More »

Looping Statements in JavaScript

In this tutorial, we will learn about Looping Statements in JavaScript We use Looping Statement to run a piece of code multiple time without writing it again and again. Suppose we want to write 1 to 100 on-screen we can do this easily with the help of loop. JavaScript provides us with four kinds of Looping Statements we will learn about these and we will check the example of every Looping Statement. These statements are as follow: for loop while loop do-while loop Now we will check each statement in detail with example. for loop: We use for a loop when we want to run a piece of code for a fixed number of time. <script> for (i=1; i<=10; i++) { document.write(i + ” “) } </script> while loop: we use this statement when we do not know how much time loop will run but we only know about the condition. <script> var num=1; while (num<=10) { document.write(num + ” “); num++; } </script> do-while loop: This looping statement is the same as while loop expects it will run once even if the condition is false. <script> var num=1; do{ document.write(num + ” “); num++; }while (i<=10); </script>   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Looping Statements in JavaScript Read More »

Branching Statements in JavaScript

In this tutorial, we will learn about different Branching statements in JavaScript. Like other programming languages JavaScript also has Branching statements that allow us to add conditions in our Code. For Example, you want to add a condition where a user can only submit a form if He/She adds 10 digits to the mobile number. If someone tries to provide the wrong mobile number(less than 10 digits) they would be not allowed to submit the form. There are mainly four kinds of branching statements available in JavaScript. These branching statements are as follows. Now we will check all these branching statements in detail. If Statement:  We use the if statement when we want to run a piece of code only if a certain condition is true. Please check out the syntax of the if statement. To understand the statement please check the following example program. In the following program, we check the num variable’s value in the if statement. If the value of the num variable will be equal to 10 then it will show message num is equal to 10.  To understand the flow of the if statement. Please check out the following flow chart diagram of the if statement. If else Statement: We use an if-else statement in case we want to run separate pieces of code for both conditions(true and false). In the if-else statement, in the case of the true condition if block will run, and in the case of false condition else block will run. Please check out the syntax of the if-else statement. Please check out the following program under the if-else statement more wisely. To understand the flow of the if-else statement. Please check out the following flow chart diagram. Else if Statement: We use an else if statement in case we have multiple conditions and we want to run a piece of code from the block where the condition would be true. The construct is also known as a ladder. In this statement, the if statement is followed by n number of else if statements and at last an else statement comes after the required number of else if statements. Please check out the following syntax of the else if statement. Please check out the following program which allows checking students’ grades using else if condition. To understand the flow of the else-if statement. Please check out the following flow chart diagram. Switch Statement: We use a switch statement in case we have multiple choices. In the case of the switch statement, it tasks an expression and matches this expression will all available cases in the statement. Please check out the following syntax of the switch statement. Please check out the following example program of the switch statement. To understand the flow of the switch statement. Please check out the following flow chart diagram. Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Branching Statements in JavaScript Read More »

Operators in JavaScript

In this tutorial, we will learn about Operators in JavaScript. Operators are special symbols and we use these operators to perform some operation on operands. For example, we want to add two number 5 and 10 so we will use the + operator there to add these two numbers. JavaScript provides us with a variety of operators. These operators are categorized into these following categories. Arithmetic Operators Relational Operators Bitwise Operators Logical Operators Assignment Operators Now we will check all these operators in detail. we will check each category. Arithmetic Operators: Arithmetic Operators are used to performing normal mathematical operations. For example to perform addition, subtraction. We have a total of five operators in this category. Operator Description Example + Addition 10+20 = 30 – Subtraction 20-10 = 10 * Multiplication 10*20 = 200 / Division 20/10 = 2 % Modulus 20%10 = 0 Relational Operators: Relational Operators are used to performing check relation between two operands operations. For example, check less than or greater than. We have a total of eight operators in this category. Operator Description Example == Is equal to 10==20 = false === Identical (equal and of same type) 10==20 = false != Not equal to 10!=20 = true !== Not Identical 20!==20 = false > Greater than 20>10 = true >= Greater than or equal to 20>=10 = true < Less than 20<10 = false <= Less than or equal to 20<=10 = false Bitwise Operators: Bitwise Operators are work on the bit level of the operand. We have a total of seven operators in this category. Operator Description Example & Bitwise AND (10==20 & 20==33) = false | Bitwise OR (10==20 | 20==33) = false ^ Bitwise XOR (10==20 ^ 20==33) = false ~ Bitwise NOT (~10) = -10 << Bitwise Left Shift (10<<2) = 40 >> Bitwise Right Shift (10>>2) = 2 >>> Bitwise Right Shift with Zero (10>>>2) = 2 Logical Operators:  Logical Operators are work between two expressions. We have a total of three operators in this category. Operator Description Example && Logical AND (10==20 && 20==33) = false || Logical OR (10==20 || 20==33) = false ! Logical Not !(10==20) = true Assignment Operators: Assignment Operators are normally used to assign value to a variable. We have a total of six operators in this category. Operator Description Example = Assign var a=10; += Add and assign var a=10; a+=20; Now a = 30 -= Subtract and assign var a=20; a-=10; Now a = 10 *= Multiply and assign var a=10; a*=20; Now a = 200 /= Divide and assign var a=10; a/=2; Now a = 5 %= Modulus and assign var a=10; a%=2; Now a = 0 Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Operators in JavaScript Read More »

Data Types in JavaScript

In this tutorial, we will learn about Data Types in JavaScript. The data type of a variable simply tells us what kind of data that variable can store and how much size of data it can hold. Java Script provides us with a variety of Data Types we will learn about these data types. Primitive data types: Data Type Description String Represents a sequence of characters e.g. “hello” Number Represents numeric values e.g. 100 Boolean Represents boolean value either false or true Undefined Represents undefined value Null Represents null i.e. no value at all Non-primitive data types: Data Type Description Object Represents instance through which we can access members Array Represents a group of similar values RegExp Represents regular expression Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Data Types in JavaScript Read More »

Variables in JavaScript

In this tutorial, we will check variables in JavaScript. If you learnt any programming language before then you would have an idea what these variables are. For those who never heard this word before variables are simply named of storage locations. Meanwhile working on any program we store some values in different memory locations and variables simply reference to these memory locations and allow us to fetch values from these memory locations. There are some rules as other languages while writing the identifiers of these variables. Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign. After first letter we can use digits (0 to 9), for example value1. JavaScript variables are case sensitive, for example name and Name are different variables. Some valid variable names: <script> var x = 10; var min_age=”18; var name=”Owlbuddy”; </script> Difference Between Local and Global Variables: Local Variables:  Variables which we declare inside a block or inside a function are known as a local variable and where these variable are declared only that function or block can use these variables. <script> function show(){ var name=”owlbuddy”;//local variable } </script> Global Variables: Variables which we declare outside of the block or any function are known as global variables and these can use from anywhere in code. <script> var name=”owlbuddy”;//gloabal variable function show1(){ document.writeln(name); } function show2(){ document.writeln(name); } </script>   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

Variables in JavaScript Read More »

CSS Padding

In this tutorial, we will learn about CSS Padding. The CSS padding property is used to add some empty space around the HTML element. CSS padding works from outside to inside means CSS padding defines the space between an HTML element and its border. you can set the padding for each side (top, right, bottom, and left) separately or you can set padding to all four sides together. Setting Padding Individual Sides: There are four CSS properties to set the padding for each side. These are as follow: padding-top padding-bottom padding-right padding-bottom div { padding-top: 20px; padding-bottom: 20px; padding-right: 25px; padding-left: 25px; } In padding properties we can use the following values: auto – the browser automatically calculates the padding for an element. length – use simple px, pt, cm, values to mention padding. % – specifies padding in % of the element. inherit – it means padding should be inherited from the parent element. div { padding-top: 20px; padding-bottom: 20px; padding-right: auto; padding-left: auto; } Shorthand Padding Property: Shorthand padding property used to specify the padding for all four sides in a single line. Please check the following example: div { padding: 15px 20px 30px 25px; /* top padding is 15px */ /* right padding is 20px */ /* bottom paddingis 30px */ /* left padding is 25px */ } CSS padding property with three values: div { padding: 15px 20px 25px; /* top padding is 15px */ /* right and left padding are 20px */ /* bottom padding is 25px */ } CSS padding property with two values: div { padding: 15px 20px; /* top and bottom padding are 15px */ /* right and left padding are 20px */ } CSS padding property with a single value: div { padding: 15px; /* padding of all four sides is 15px */ }   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

CSS Padding Read More »

CSS Margins

In this tutorial, we will learn about CSS Margins. CSS margin property is used to set space around the HTML elements. CSS margin property can be used to set margin separately for each side(top, right, bottom, and left) or together to all four sides. Setting Margin Individual Sides: There are four CSS properties to set the margin for each side. These are as follow: margin-top margin-bottom margin-right margin-bottom p { margin-top: 20px; margin-bottom: 20px; margin-right: 25px; margin-left: 25px; } In margin properties we can use the following values: auto – the browser automatically calculates the margin for element length – use simple px, pt, cm, values to mention margin. % – specifies a margin in % of the element inherit – it means margin should be inherited from the parent element p { margin-top: 20px; margin-bottom: 20px; margin-right: auto; margin-left: auto; } Shorthand Margin Property: Shorthand margin property used to specify the margin for all four sides in a single line. Please check the following example: p { margin: 15px 20px 30px 25px; /* top margin is 15px */ /* right margin is 20px */ /* bottom margin is 30px */ /* left margin is 25px */ } CSS margin property with three values: p { margin: 15px 20px 25px; /* top margin is 15px */ /* right and left margins are 20px */ /* bottom margin is 25px */ } CSS margin property with two values: p { margin: 15px 20px; /* top and bottom margins are 15px */ /* right and left margins are 20px */ } CSS margin property with a single value: p { margin: 15px; /* margin of all four sides is 15px */ }   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

CSS Margins Read More »

CSS Borders

In this tutorial, we will learn about CSS Borders. CSS Borders are used to set Border around HTML elements. In CSS we set Border style, Border thickness, Border colour etc. Here we will learn several CSS properties to set border of any HTML element. border-style border-width border-color Border Style: Border style properties are used to set the style of the border there are several border styles available in CSS. Check the list of CSS Border style: dotted: This style is used to set a dotted border style around the HTML element. p{border-style: dotted;} solid: This style is used to set a solid border style around the HTML element. p{border-style: solid;} dashed: This style is used to set a dashed border style around the HTML element. p{border-style: dashed;} groove: This style is used to set groove border style around the HTML element. p{border-style: groove;} hidden: This style is used to set a hidden border style around the HTML element. p{border-style: hidden;} inset: This style is used to set inset border style around HTML element p{border-style: inset;} outset: This style is used to set outset border style around HTML element. p{border-style: outset;} none: This style is used to set none border style around the HTML element. p{border-style: none;} ridge: This style is used to set ridge border style around the HTML element. p{border-style: ridge;} double: This style is used to set a double border style around the HTML element. p{border-style: double;} CSS Border Width: CSS border-width property is used to define the width of the border. you can define border-width in px, pt, cm, em etc. p{ border-width: 5px;} CSS Border colour: CSS border-colour property is used to define the colour of the border. you can define border-color using standard_color, Hexa value, RGB value etc. p{ background-color: red;}   Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

CSS Borders Read More »

CSS Backgrounds

In this tutorial we will learn about CSS Backgrounds. CSS Background is use to add background in HTML elements. There are various CSS Background properties available Here to set Background. background-color background-image background-repeat background-attachment background-position Parvesh SandilaParvesh Sandila is a passionate web and Mobile app developer from Jalandhar, Punjab, who has over six years of experience. Holding a Master’s degree in Computer Applications (2017), he has also mentored over 100 students in coding. In 2019, Parvesh founded Owlbuddy.com, a platform that provides free, high-quality programming tutorials in languages like Java, Python, Kotlin, PHP, and Android. His mission is to make tech education accessible to all aspiring developers.​ new.owlbuddy.com

CSS Backgrounds Read More »

Scroll to Top
×