Create a function.
Functions are the primary means of passing data around in JavaScript.
TypeScript allows you to specify the types of both the input and output values of functions.
exemple :
function addNumbers(a: any, b: any): number {return a + b;}
inputs : a: any, b: any
outputs : a + b
- Function with no parameter and no return value (no inputs or outputs)
- Function with parameter of type any and a return value
- Function with Typed Parameter
إنشاء وظيفة.
الوظائف هي الوسيلة الأساسية لتمرير البيانات في JavaScript.
يتيح لك TypeScript تحديد أنواع قيم الإدخال والإخراج للوظائف.
مثال :
الوظيفة addNumbers(a: Any, b: Any): الرقم {return a + b;}
المدخلات: أ: أي، ب: أي
المخرجات: أ + ب
- وظيفة بدون معلمة ولا قيمة إرجاع (بدون مدخلات أو مخرجات)
- وظيفة مع معلمة من النوع أي وقيمة الإرجاع
- وظيفة مع المعلمة المكتوبة
Créez une fonction.
Les fonctions sont le principal moyen de transmettre des données en JavaScript.
TypeScript vous permet de spécifier les types des valeurs d'entrée et de sortie des fonctions.
exemple :
function addNumbers(a: any, b: any): nombre {return a + b;}
entrées : a : quelconque, b : quelconque
sorties : a + b
- Fonction sans paramètre et sans valeur de retour (pas d'entrées ni de sorties)
- Fonction avec paramètre de type any et une valeur de retour
- Fonction avec paramètre typé
Негізгі бет fonctions TypeScript | functions TypeScript | وظائف تايب سكريبت
Пікірлер