Functions

(Practical)

1. Create a function that will take any number of arguments and return their sum.

2. Make this function be able to take array as argument.

In Browser environment declare a variable:

var myVar = { key: 'value' };

Look at 

window.myVar;

1. Declare a private variable using IIFE.

2. Is there any other ways how to declare private variables in JavaScript ?

1. Create a function called celsiusToFahrenheit:

          Store a celsius temperature into a variable.
          Convert it to fahrenheit and output "NN°C is NN°F".

 

2. Create a function called fahrenheitToCelsius:

          Now store a fahrenheit temperature into a variable.
   Convert it to celsius and output "NN°F is NN°C."

 

 

F = C * 1.8 + 32

Write a JavaScript function that accepts a string as a parameter and find the longest word within the string.

 

Example string : 'Hello, GlobalLogic!'
Expected Output : 'GlobalLogic'

1. Write a function that can print entity details based on next model:

{
  name: String,
  type: String,
  age: Number
}

Expected output: "%NAME%(%TYPE%) - %AGE%."

2. Rewrite that function to use this instead of argument (use apply, call and bind to print the details of different entities).

Made with Slides.com