Question by
snatvb · Oct 02, 2016 at 05:40 AM ·
javascriptfunctionsgenericsargument
Dynamic Parameters/Arguments type in javascript
Hi! I whant get argunet with dynamic type. I have head about Generics, but I don't find there information about javascript dynamic type. I hope that here anybody can help me. Thanks.
public function addItem (item) : boolean {
if (!item || !item.weight) return;
if (item.weight > item.weight + inventoryWeight) return false;
items.push(item);
inventoryWeight += item.weight;
return true;
}
I need convert this code in js
public class SomeClass
{
//Here is a generic method. Notice the generic
//type 'T'. This 'T' will be replaced at runtime
//with an actual type.
public T GenericMethod<T>(T param)
{
return param;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612093829im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem with Contains 0 Answers
How to add a Type to a Class in Javascript? 1 Answer
Game got slow down On iphone 0 Answers
Can anyone make a timer for me? 0 Answers
How can i make an animation like csgo case opening? 2 Answers