{"id":101,"date":"2026-05-01T15:51:30","date_gmt":"2026-05-01T15:51:30","guid":{"rendered":"https:\/\/gigz.pk\/javascript\/?post_type=lesson&#038;p=101"},"modified":"2026-05-01T15:51:31","modified_gmt":"2026-05-01T15:51:31","slug":"parameters-and-return-values","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values","title":{"rendered":"Parameters and Return Values"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Parameters and return values are important concepts in programming that make functions more powerful, reusable, and flexible. They are widely used in JavaScript to pass data into functions and get results back.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are Parameters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Parameters are variables defined inside a function that receive input values when the function is called. They act as placeholders that allow functions to work with different data each time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function greet(name) {<br>  console.log(\"Hello \" + name);<br>}<br><br>greet(\"Ali\");<br>greet(\"Sara\");<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, name is a parameter that takes different values each time the function runs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are Return Values<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A return value is the output of a function. It sends data back to the place where the function was called using the return keyword.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function add(a, b) {<br>  return a + b;<br>}<br><br>let result = add(5, 10);<br>console.log(result);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here, the function returns the sum of two numbers and stores it in a variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Importance of Parameters and Return Values<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">They make functions reusable<br>They help manage and organize code<br>They allow dynamic input handling<br>They improve code readability<br>They support modular programming<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Real World Use in Websites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Handling form input validation<br>Performing calculations in web applications<br>Displaying dynamic content on pages<br>Processing API data<br>Managing user interactions<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Parameters are used to pass input into functions and return values are used to get output from functions. Together they make JavaScript functions powerful and essential for building dynamic websites.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/javascript\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Intermediate JavaScript > Functions > Parameters and Return Values<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777650664990\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777650664755\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-101","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Parameters and Return Values - Learn JavaScript with GIGZ.PK<\/title>\n<meta name=\"description\" content=\"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Parameters and Return Values - Learn JavaScript with GIGZ.PK\" \/>\n<meta property=\"og:description\" content=\"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values\" \/>\n<meta property=\"og:site_name\" content=\"Learn JavaScript with GIGZ.PK\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-01T15:51:31+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=parameters-and-return-values\",\"url\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=parameters-and-return-values\",\"name\":\"Parameters and Return Values - Learn JavaScript with GIGZ.PK\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/#website\"},\"datePublished\":\"2026-05-01T15:51:30+00:00\",\"dateModified\":\"2026-05-01T15:51:31+00:00\",\"description\":\"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=parameters-and-return-values#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=parameters-and-return-values\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=parameters-and-return-values#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/javascript\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Intermediate JavaScript > Functions > Parameters and Return Values\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/\",\"name\":\"Learn JavaScript with GIGZ.PK\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Parameters and Return Values - Learn JavaScript with GIGZ.PK","description":"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values","og_locale":"en_US","og_type":"article","og_title":"Parameters and Return Values - Learn JavaScript with GIGZ.PK","og_description":"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily","og_url":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values","og_site_name":"Learn JavaScript with GIGZ.PK","article_modified_time":"2026-05-01T15:51:31+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values","url":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values","name":"Parameters and Return Values - Learn JavaScript with GIGZ.PK","isPartOf":{"@id":"https:\/\/gigz.pk\/javascript\/#website"},"datePublished":"2026-05-01T15:51:30+00:00","dateModified":"2026-05-01T15:51:31+00:00","description":"Learn JavaScript parameters and return values to create reusable functions and build dynamic interactive websites easily","breadcrumb":{"@id":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/javascript\/?lesson=parameters-and-return-values#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/javascript"},{"@type":"ListItem","position":2,"name":"Intermediate JavaScript > Functions > Parameters and Return Values"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/javascript\/#website","url":"https:\/\/gigz.pk\/javascript\/","name":"Learn JavaScript with GIGZ.PK","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/javascript\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/lesson\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}