# Undefined Function Eq For Input Arguments Of Type Cell Undefined Function Eq For Input Arguments Of Type Cell

In this article, you will learn”Undefined Function Eq For Input Arguments Of Type Cell”. In the following code, we have a function that accepts an input array and returns an output array. The function is defined for both input and output arguments:

function eq(a, b) { return [a == b, a == b, …]; }

But when we call this function with two different types of arguments (cell or string), it gives unexpected results! What happened?

# Problem

You can see the problem with this function by inspecting its output:

• The second argument is an array; it should be treated as a vector.
• The third argument is an array; it should be treated as a matrix.

## Solution

• You can identically use the input arguments by defining the function as follows:

function eq(x,y) {return x == y;}

• Define the problem.
• Explain the solution.
• Describe what the output arguments are if they’re not obvious from context or by reading this document (e.g., “an integer” or “a string”).

#### Input Arguments

Input Arguments are the things you provide to a function. They can be values, variables, or expressions.

• A value is any object that can be assigned to a variable (e.g., 5).
• A variable is an assignment statement in C# or JavaScript (e.g., var x = 1).
• The interpreter evaluated an expression and appears as one of its results (e.g., 3 + 4).

#### Output Arguments

The arguments of the function are:

• a_array – a cell array, as described in the previous section.
• b_array – another cell array, as described in the previous section.

#### Undefined function eq for input arguments of type cell

The following is an example of a program that uses the undefined function eq for input arguments of type cells.

function x(a, b) {return a == b;}console.log(x(1,2));Console.log(x(‘a’, ‘b’));

##### Conclusion

Since the argument types are not known at the definition time, it is impossible to check whether the type exists. However, since JavaScript has type inference and since objects have a default constructor function with arguments passed to them (i.e., new), we can use this when defining our functions:

function eq(x) { return x === y; }

We can now define a function to evaluate whether two numbers are equal! 