Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何编写需要JavaScript输入的函数_Javascript_Jquery_Function - Fatal编程技术网

如何编写需要JavaScript输入的函数

如何编写需要JavaScript输入的函数,javascript,jquery,function,Javascript,Jquery,Function,如何创建需要JavaScript输入的函数 例如: var a = 0; var b; function A(int myInteger){ //should it be something like var myInteger? // do something with myInteger // print something or do a = myInteger; } function B(a){ // do something with recieved integer } 请

如何创建需要JavaScript输入的函数

例如:

var a = 0;
var b;
function A(int myInteger){    //should it be something like var myInteger?
 // do something with myInteger
// print something or do a = myInteger;
}
function B(a){
// do something with recieved integer
}

请帮帮我。

我建议您阅读一些关于javascript的教程

要回答这个问题:

var a = prompt('Input something here:');
/* do something here with a */

然后转到这个站点:开始学习旅程。

JavaScript中没有数据类型,只有var,JS中的一切都是var

因此,在传递变量时,不必同时提及变量。只需传递您的值。在创建函数时也是如此。只需提及变量名称。就这样

所以

//干杯


正如大家所说的,欢迎来到JS和W3School。

JavaScript中没有int关键字。删除int后,您所做的工作是否无效?
var a = 0;
var b;
function A(a){    //passing your varible 
 // do something with a
// print something or do a = myInteger;
}
function B(b){
//Ex :call function A here 
A(b);
}