File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //asic Function Declaration
2+ function aman ( ) {
3+ console . log ( "Hello mere bhai" )
4+ }
5+ aman ( )
6+ function anup ( ) {
7+ console . log ( "Hello Kya kr rahe hoo" )
8+ }
9+ anup ( ) ;
10+ //Function with Parameters
11+ //Parameters let you pass values into a function.
12+ function greet ( name ) {
13+ console . log ( "Hello " + name ) ;
14+ }
15+
16+ greet ( "Anup" ) ;
17+ greet ( "Rahul" ) ;
18+
19+ function greet ( name ) {
20+ console . log ( "Hello " + name ) ;
21+ }
22+ greet ( 'Anup' ) ;
23+ greet ( "Abhishek" ) ;
24+
25+
26+ function abhishek ( name ) {
27+ console . log ( "Hello " + name ) ;
28+ }
29+
30+ abhishek ( "Kya kr rha hai" ) ;
31+ abhishek ( "kya kr rahe ho tum" ) ; //Call the function OutSide
Original file line number Diff line number Diff line change @@ -89,4 +89,25 @@ function loginUserMessage(username = "sam"){
8989 return `${ username } just logged in`
9090}
9191
92- console . log ( loginUserMessage ( "Anup" ) )
92+ console . log ( loginUserMessage ( "Anup" ) )
93+
94+ function loginUserMessage ( username = "anup" ) {
95+ if ( username ) {
96+ console . log ( "Please enter a username" ) ;
97+ return
98+ }
99+ return '${username} just logged in'
100+ }
101+
102+
103+ function greet ( ) { //Basic Function Declaration
104+ console . log ( "Hello JavaScript!" ) ;
105+ }
106+
107+ greet ( ) ; // calling the function
108+
109+
110+ function aman ( ) {
111+ console . log ( "Hello mere Bhai" ) ;
112+ }
113+ aman ( ) ;
You can’t perform that action at this time.
0 commit comments