Picture of use of functions in JavaScript

Returning Value of Functions in JavaScript | Use of JavaScript

Returning Value of Functions in JavaScript | Use of JavaScript

In this article, you will get information about Returning Value of Functions in JavaScript. If you want to learn about it then you must read the full article till the end. I hope you will like this article.

Picture of use of functions in JavaScript




What is returning value of functions?

How to use functions in JavaScript?

How to implement functions in JavaScript?

If these entire questions are related to your query then you are at right place. Here you will get the right information about this topic.

If you want to become a successful web designer or front end designer then you must have good knowledge of JavaScript. So you can learn JavaScript from here.

If you want to learn about functions then you should read the previous article. You can move to the previous article from below link.

Use of Functions in JavaScript




If you want to boost your JavaScript programming knowledge then you must read this book. It is really a wonderful weapon to learn JavaScript.

Returning Value of Functions

Here I am giving you some useful points about returning value of functions in JavaScript.

  • Functions may return a value using keyword “return”.
  • Functions can only return one value.
  • Once a function returns a value, control returns back to the caller.




Example:

<!DOCTYPE html>
<html>
<head>
	<title>Return Value of functions</title>
</head>
<script type="text/javascript">
	function sum(a,b){
		return(a+b);
	}
</script>
<body>
<h1>Welcome</h1>
<script type="text/javascript">
	var s=sum(3,8);
	document.write("sum of a and b :"+s);
</script>
</body>
</html>




Output:

Returning Value of Function in JavaScript

Conclusion

Finally, I hope you got information about Returning value of functions in JavaScript. I hope now you understand how to use functions with returning value.




If you have any questions regarding this article then you can ask me in the comment section below.

Thank you for reading this article till the end.

Picture of use of functions in JavaScript

Use of Functions in JavaScript | Use of JavaScript With HTML File

Use of Functions in JavaScript | Use of JavaScript With HTML File

 

In this article, you will learn about the use of functions in JavaScript. If you are also interested to learn about this topic then you should read this article till the end. Here I will explain you this topic with the help of an example.




Picture of use of functions in JavaScript

What is the function in JavaScript?

How to use functions in JavaScript?

How to write a code of functions in JavaScript?

If you have also these questions then you are at right place. Here you will get the right information regarding this topic. I hope you will love this article.

You should also read them:

Control Statements in JavaScript

Use of Switch Case in JavaScript




If you want to boost your JavaScript programming knowledge then you must read this book. It is really a wonderful weapon to learn JavaScript.

Functions in JavaScript

  • Functions are a block of code designed to perform a certain action.
    • function functionName(variableList){
      
      }
  • For Example, You want to add a separate functionality in your webpage. Like you want to convert Kg in gm. Then you will write some code of JavaScript in a separate block. Or you want to calculate the percentage of a product then you will write some code of JavaScript in a block. Thus you can write many types of code in different blocks.
  • It means you want to do many tasks in a single webpage then you will give a separate block for a separate task. These blocks are called a function. And you can use them at a different time in different places.
  • And we need to give a separate name for a single block of function.
  • Here you need to write a keyword “function”, before the name of the function. And you need to write it in small letters.

Function Execution

  • The function is executed when
    • The function is invoked from another JS function.
    • The function is attached to some event and event occurs.

Why Function

  • You can reuse code.
  • The script inside the function is not executed until the function is invoked.

Variables in Functions

  • Local Variable
  • Global Variable

Local Variable

When you will create a variable under a function then it called a local variable. The variable’s functionality will work on the body of that function. You can create a variable by write “var” keyword. You cannot use local variable out of that function’s body.




For Example:

<script>

Function hello(){

Var x;

}

</script>

Global Variable

If you want to create a global variable then you will not write a “var” keyword while declaring a variable. You can use a global variable in your whole webpage.

For Example:

<script>

Function hello(){

Y=2;

}

</script>

Example:

<!DOCTYPE html>

<html>

<head>

<title>Functions in JavaScript</title>

</head>

<body>

<script type="text/javascript">




function skillmaking()

{

document.write("Welcome in SKILL MAKING");

}

</script>

<h1>

Welcome

</h1>

<script type="text/javascript">

skillmaking();

</script>

</body>

</html>

The output of The use of Functions in JavaScript:

Picture of use of functions in JavaScript




Conclusion

Finally, you got information about the use of functions in JavaScript. I hope you got the information which you want. If you find this article useful then please share it with your friends. Thank you for reading this article till the end.

Picture of Use of Prompt Box in JavaScript

Use of Prompt Box in JavaScript | Use of JavaScript with HTML

Use of Prompt Box in JavaScript | Use of JavaScript with HTML

 

In this article, I will share some information about JavaScript. Here you will get information about Use of Prompt Box in JavaScript. If you want to learn the use of the prompt box then you should read this article till the end. I hope you will love it.

What is Prompt Box in JavaScript?

How to use a prompt box in JavaScript?

How to use JavaScript with HTML file?




If you also having these questions then you should read this article till the end. Here you will get information about the use of Prompt Box in JavaScript.

You should also Read these articles:

Use of Alert Box in JavaScript

Use of Confirm Box in JavaScript

If you want to boost your JavaScript Programming knowledge then you must read this book. It will be helpful to grow your knowledge of JavaScript.

Prompt Box in JavaScript

  • A prompt box in often used if you want the user to input a value before entering a page.
  • When a prompt box pops up, the user will have to click either “OK” or “Cancel” to proceed after entering an input value.
  • If the user clicks “OK” the box returns the input value. If the user clicks “Cancel” the box returns null.
  • prompt(“message”,”defaultValue”);
  • Here the second argument “defaultValue” is optional. You can skip this argument.

Example:

<!DOCTYPE html>

<html>

<head>

<title>Pop Up Boxes</title>
<script type="text/javascript">
 var x=prompt("Enter a value: ","3"); 
if(x!=null)
{
 for(i=1;i<=10;i++)
 document.write("<br/>"+x+"x "+i+"= "+x*i);
 }
 </script>

</head>

<body>






<h1>Welcome</h1>
</body>



</html>

The output of Prompt Box:

Picture of Prompt Box in JavaScriipt    Picture of Prompt Box in JavaScriipt




Conclusion

Finally, you got information about the use of the prompt box in JavaScript. I hope you got some useful article. If you find it helpful then please share it with your friends. Thank you for reading this article till the end.

Picture of Confirm Box in JavaScript

Use of Confirm Box in JavaScript| Use of JavaScript with HTML file

Use of Confirm Box in JavaScript| Use of JavaScript with HTML file

 

In this article, I will share some information about the use of confirm box in JavaScript. If you also want to know the use of confirm box then you must read this article till the end.

In the previous article, you learned about the Use of Alert Box in JavaScript.

What is Confirm Box in JavaScript?

How to use confirm box in JavaScript?

If you have both these questions then you should read this article till the end. Here I will explain to you about this topic with an example.




If you want to boost your JavaScript Knowledge then you should buy this book. I recommend it for every JavaScript learner. You must read this.

Confirm Box

  1. Confirm box has two buttons where first one is “OK” and second one is “cancel”.
  2. Here the browser needs some confirmation from the user.
  3. When a confirm box popup, the user will have to click either “OK” or “Cancel” to proceed.
  4. If the user clicks “OK”, the box returns true. If the user clicks “Cancel”, the box returns false.

Code:

confirm(“Some Message”);

Example:

<!DOCTYPE html>

<html>

<head>

	<title>Pop Up Boxes</title>

<script type="text/javascript">

	var x=confirm("This is confirm box");

	if(x){

		document.getElementsByTagName("body")[0].style.backgroundColor="blue";

	}

</script>
</head>
<body>
<h1>Welcome</h1>
</body>






</html>

The output of Use of Confirm Box in JavaScript

Picture of Confirm Box in JavaScript

Conclusion

Finally, you got information about the use of confirm box in JavaScript. I hope you got some informative article. If you like it as useful then please share it with your friends. Thank you for reading this article till the end.




You should also read these articles.

Alert Box in JavaScript

Control Statements in JavaScript

Use of popup boxes in javascript

Use of Pop Up Boxes in JavaScript | Use of Alert Box in JavaScript

Use of Pop Up Boxes in JavaScript | Use of Alert Box in JavaScript

 

In this article, I will share some information about JavaScript. Here I will share a very important topic of JavaScript “Use of Pop Up Boxes in JavaScript” and “Use of Alert Box in JavaScript”. If you also want to know about this topic then you must read this article till the end.

Do you want to become a successful Web Developer?

Do you want to learn about the use of pop up boxes in JavaScript?




If your answer for both of these questions then you are at right place. Here I will explain to you about use of pop up boxed in JavaScript. I hope you will read this article till the end.

If you want to boost your JavaScript Knowledge then you must read this book which is given below.


You should also read these articles.

Switch Case in JavaScript

Introduction of JavaScript

Use of Pop Up Boxes in JavaScript

JavaScript has three kinds of Pop up boxes. The list of pop up boxes is given below.

  • Alert Box
  • Confirm Box
  • Prompt Box

First of all, let’s talk about Alert Box

  1. Use of Alert Box in JavaScript

  • JavaScript has a function of the name alert(). Where we give a message who appeared in the alert box.
  • It has a single button “OK”.
  • If you will use this code then an alert box will arise at the starting of the webpage. And the webpage will not proceed till you press the “OK” button.

Example of Alert Box

<!DOCTYPE html>

<html>

<head>

	<title>Pop Up Boxes</title>

</head>

<body>




<script type="text/javascript">

	alert("This is alert box");

</script>

</body>

</html>

The output of Alert Box

Alert Box in JavaScript




Conclusion

Finally, you got the information about the Use of the alert box in JavaScript. I hope you got this article helpful for you. In the upcoming article, I will share about Confirm box and Prompt box. I hope you will read them. Thank you for reading this article till the end. If this article is helpful for you then please share it with your friends.

 

use of switch case in javascript

Use of Switch Case in JavaScript | Use of JavaScript in HTML file

Use of Switch Case in JavaScript | Use of JavaScript in HTML file

 

In this article, you will get information about the use of switch case in JavaScript. This is also a very important chapter of JavaScript. If you want to become a successful JavaScript programmer then you must know about this chapter.




How to use switch case in JavaScript?

Do you want to become a successful web designer?

If you have these questions then you should read this article till the end. In this article, you will find that how to use switch case in JavaScript with an example. I hope you will love this article.

If you want to boost your JavaScript programming language then you must read this book. The book is given below.





You must read these articles to improve your JavaScript skills.

Introduction of JavaScript

Control Statements of JavaScript

Now let’s talk about the use of switch case in JavaScript.

  • Here we use switch keyword.
  • Write an expression for the switch to case.
  • The expression compares with all cases and when the case matches then the code will execute.
  • After a case, we write break keyword.
  • At the end, we write a default case and write some code in default.




Switch(expression){

                Case n1:

                                //code here

                                Break;

                Case n2:

                                //code here

                                Break;

                Case n3:

                                //code here

                                Break;

                Default:

                                //code here

                }




Example:

<!DOCTYPE html>

<html>

<head>

	<title>Switch Case in JavaScript</title>

</head>

<body>

<script type="text/javascript">

	var x=1+1;

	switch(x){

		case 1:

		document.write(x+" is one");

		break;

		case 2:

		document.write(x+" is two");

		break;

		case 3:

		document.write(x+" is three");

		break;

		default:

		document.write(x+" is negative");

		break;

	}

</script>

</body>

</html>




The output of Switch case in JavaScript:

picture of switch case in javascript




Conclusion

In this article, you get information about how to use switch case in JavaScript. Here you got your answer with example and the output of the code. Thank you for reading this article till the end. If you have any questions regarding this article then you should write down it in the comment section below.

use of else if ladder in javascript

Use of Else if Ladder | Control Statements in JavaScript

Use of Else if Ladder | Control Statements in JavaScript

In this article, you will get one also an important chapter of JavaScript. Here I will explain you else if ladder. It is also a control statement of JavaScript.




Do you want to become a good programmer of JavaScript?

Do you want to get deep knowledge of JavaScript?

How can use else if ladder in JavaScript?

If you have all these questions then you are at right place. Here I will explain to you how to use else if ladder.

If you want to boost your knowledge of JavaScript then I suggest you a book. You must read this book for deep knowledge of JavaScript.






You should also visit previous chapters of JavaScript.

Basics of JavaScript

Best Way to write JavaScript code with the html file

Control Statements of JavaScript

Now let’s talk about Else if ladder. Here some key points of else if ladder is given below. You must read these key points.

  • Here you can use else if condition many times.
  • If first condition is true then the code of the first condition will execute.
  • Only one condition will execute at a time.




Example:

<!DOCTYPE html>

<html>

<head>

<title>Else If Ladder Statements</title>

</head>

<body>

<script type="text/javascript">

var y=-25;

if(y>0){

document.write(y+" is a positive number.");

}

else if(y==0){

document.write(y+" is zero.");

}

else{

document.write(y+" is negative.");

}

</script>




</body>

</html>




The output of Else If Ladder:

else if ladder statement in javascriipt

Conclusion

In this article, you got that how to use else if ladder in JavaScript. Thank you for reading this article till the end. If you have any question regarding this article then you should write down your question in the comment section below.



picture of how to become a web developer

Best Tips to Become a Successful Web Developer

Best Tips to Become a Successful Web Developer

picture of how to become a web developer

Today in this article, we will talk about web development. Many times I face this question from people that what are the skills required to become a web developer? They want to become a web developer and also want to learn useful skills to become a web developer. Are you having also these questions like this?

 

How to become a web developer?

What are the skills required to become a web developer?

How to start to learn to become a successful web developer?

How to make money by web development?

If you have also these questions in your mind then you are at right place. Here I will share my own thoughts about this topic. I hope you will love these words. For a good result you need to read this article till the end.

Start from HTML

picture to start web development with html

You need to start from the beginning. To become a web developer, you need to start from HTML. HTML is the basic key in web design and development. Most of the time people say that they know about HTML. But I suggest them that they should revise HTML basics. Because HTML is a skeleton of a web page. Full body is based on HTML. But if we talk about design in a web page. Then it comes by CSS (Cascading Style Sheet). You can learn HTML from click here.

Go to Design a Web Page

picture of css and graphics design

After HTML you need to design a web page. The designing comes by CSS. If you want to do that your web page looks like awesome then you need to use CSS with HTML. CSS used for giving margin, fill colors, place an element in right place etc. But if you want to become an extraordinary web developer then CSS is not enough for you. Because a website is like a painting or a canvas. Graphics design is the best thing in web design. Graphics design plays a very important role in web design. Graphics Design ensoul on the web page. If a thing does not look beautiful then it cannot attract customers. So you should learn graphic design. This is a very important part to become a successful web developer. To learn CSS click here.

Automation Part in Web Design

picture of learn JavaScript

After CSS and Graphic Design, we go to automation. If you will use some extra features in your web page like a slider, movements etc. then you need to learn JavaScript. So I suggest you that you should learn JavaScript after CSS. JavaScript enhances your impression at the front of your customer. Because automation looks good on a web page. To learn JavaScript Click Here.

After learn these skills (HTML, CSS, JavaScript), you can build a static website easily. And if you want to optimize your work then the solution is given below.

Optimization of Work

If you want to optimize your work with less code. Example you need to build many websites and you don’t want to do a lot of code. Then you should learn Bootstrap. Bootstrap is a platform where you will get HTML, CSS and JavaScript merged template. It is a setup library of HTML, CSS, and JavaScript. Where suppose if you want to make a header of the webpage then you need to do import some code and that’s why you need to learn bootstrap. So if you want optimization in your web development skills and want to create a lot of websites in minimum time then you should learn Bootstrap. Bootstrap is also a very important part to become a successful web developer.

Dynamic Websites

picture of php and database

Above you read about the static website. But now we will talk about dynamic websites. So if you want to build a dynamic website and also want to become a successful web developer then you should learn PHP or Mongo DB or other database skills. If you have these skills then you can make a lot of websites with much functionality. You can make login forms, client management system, store a query, make database etc.

After these all skills you called a full stack web developer. So to become a successful web developer you need to learn HTML, CSS, Graphics Design, JavaScript, PHP etc. After these skill you can easily make a stunning websites. After these skills a question arise by people that can we use wordpress. So read continue below.

Use of WordPress To Become a Web Developer

 

I saw that many people who don’t know briefly about HTML, CSS, JavaScript, and PHP they jump to WordPress. And this is the biggest mistake in their web developer’s career. At least you need to learn PHP. They use plugins in their websites to enhance the quality of web page. But if a technical mistake arises in the website as of the client requirement then you are stuck there. And there your quality will be compromised. If you want to become a high skill web developer then you need to learn custom wordpress not plugin dependent.

Conclusion

So in this article, we learn that, what are the requirements to become a web developer? So you need to start from beginning with HTML then you should learn CSS and graphics designing. And then you should learn JavaScript to enhance your web page quality. After these skills you can make a static websites. And if you want to get more then you should learn PHP, Mongo DB etc. to make Dynamic Websites.

So these are my thoughts about how to become a successful web developer? I hope you love this article. What are your thoughts about Web Development suggest me in the comment section below? Thank you for reading this article till the end.

javascript skillmaking

Best Ways to write JavaScript Code for HTML file

Best Ways to write JavaScript Code for HTML file

You should also read these articles

Table Tag

Introduction of JavaScript

Today in this article I will tell you something about JavaScript basics. If you have any problem to write JavaScript code or if you are a beginner in JavaScript then you are at right place. Here you can get the right answer for your query. Here you can get the best ways to write JavaScript Code for HTML file. I hope you will get your answer. These are some points may help you to write JavaScript Code




  • You can write JavaScript code in the same HTML file.
  • You can write JavaScript code into the same HTML file like this:
<script type=”text/javascript”>
-------------------------
-------------------------
</script>
  • You can also write JavaScript code in a separate file, which can be embedded into your HTML file. You don’t need to write <script> tag in your separate file which has .js extension.
  • You can embed your external .js file with your HTML file by follow this:
<script type=”text/javascript” src=”externalfile.js”>
</script>

If you want to boost your JavaScript knowledge then you should buy this book. This is recommended by me.




Write JavaScript Code into HTML file

  • JavaScript code must be inserted between <script> and </script> tags.
  • You can place JavaScript code at anywhere in HTML document (body or head).
  • You should start your JavaScript code like this
<script type=”text/javascript”>
</script>
  • The type attribute is not always required. JavaScript is the default scripting language in HTML.

Best Ways to write JavaScript Code

  • You can write JavaScript code into <head> tag.
  • You can write JavaScript code into <body> tag.
  • You can write JavaScript code into an external file.




  1. Write JavaScript Code into the head tag

If you want to write JavaScript code into <head> tag then you should follow this type to write your JavaScript code.

<html>

<head>

<script type=”text/javascript”>

document.write(“welcome”);

</script>

<body>

<h1>Welcome SKILLMAKING </h1>

</body>

</html>

Output:

write javascript code

  1. Write JavaScript Code into body tag

If you want to write JavaScript code into <body> tag then you should read this code which is given below. Here you can take an idea to write JavaScript code into body tag.




<html>

<head>

<title>SKILLMAKING</title>

</head>

<body>

<h1>Welcome SKILLMAKING </h1>

<script type=”text/javascript>

document.write(“welcome”);

</script>

</body>

</html>

write javascript code

  1. Write JavaScript code into external file

If you want to write JavaScript code into an external file then you should read this code which is given below.

<html>

<head>

<title>SKILLMAKING</title>

<script type=”text/javascript” src=”file.js”>

</script>

</head>

<body>

<h1>WELCOME </h1>

</body>

</html>

File.js file

document.write(“hello JavaScript”);

Output

write javascript code




Conclusion

So here you get the best ways to write JavaScript code for your HTML file. I hope you will get the right answer for your query. Thank you for reading this article till the end. If you have any question regarding this article then you should write them into the comment section below. If you love this article then show your love into the comment section below.

php question answers

Top 10 Questions And Answers for PHP Interview

Top 10 Questions And Answers for PHP Interview

php question answers



  1. What is PHP?

Ans.: PHP is an open source server-side scripting language commonly used in web applications.

  1. What is Open Source software?

Ans.: Software in which the source codes are freely used, modify, and shared by anyone is called Open Source software. These can also be distributed under licenses that adhere with the Open Source Definition.



  1. What is difference between include(), include_once() and require_once()?

Ans.: The include() statement includes and evaluates a specified line i.e. It will include a file based in the given path. require() does the same thing expect upon failure it will generate a fatal error and halt the scrip whereas include() will just gives a warning and allow script to continue. require_once() will check it the file already been included and if so it will not include the file again.

  1. What is the difference between GET, POST and REQUEST methods?

Ans.: GET and POST are used to send information from client browser to web server. In case of GET the information is send via GET method in name/value pair and is URL encoded. The default GET has a limit of 512 characters. The POST method transfers the information via HTTP headers. The POST method does not have any restriction in data size to be sent. POST is used for sending data securely and ASCII and binary type’s data. The $_REQUEST contains the content of bot $_GET, $_POST and $_COOKIE.

  1. Which are the different types of PHP?

Ans.: These are four types of errors.

  • Parse Error: Commonly caused due to syntax mistakes in codes. Ex. Missing semicolon, mismatch brackets.
  • Fatal Error: These are basically runtime errors which are caused when you try to access what can’t be done. Ex. Accessing a dead object, or trying to use a function that hasn’t been declared.
  • Warning Error: These occur when u try to include a file that is not present or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.
  • Notice Error: These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.




  1. What is the session and why do we use it?

Ans.: Session is a super global variable that preserves data across subsequent pages. Session uniquely defines each user with a session ID, so it helps to make customized web application where user tracking is needed.

  1. What is the cookie and why do we use it?

Ans.: Cookie is a small piece of information stored in the client browser. It is a technique used to identify a user using the information stored in their browser (it already visited that website). Using PHP we can both set and get COOKIE.

  1. How to print the current date and time?

Ans.: <?php

Echo date(‘Y-m-d H:i:s’);

?>

  1. What function do we use to find length of string, and length of array?

Ans.: For finding the length of string we use strlen() function and for array, we use count() function.

  1. What is the difference between unset() and unlink() function?

Ans.: unset() is used to destroy a variable whereas unlink() is used to destroy a file.