Reputation: 578
This is my JavaScript function
function movements(remove) {
var op = remove ? 'remove' : 'add';
crossvent[op](documentElement, 'selectstart', preventGrabbed); // IE8
crossvent[op](documentElement, 'click', preventGrabbed);
} function move(value) {
And this is how it's called
movements();
You can find reference for in jkanban.js file.
Now I have to change it to Typescript and I got this error on function calling,
Expected 1 arguments, but got 0
How can I resolve this problem in typescript ?
Upvotes: 16
Views: 30710
Reputation: 256
Simply add the question mark to the argument that requires your function, example:
function movements(remove?) {
// ...
}
Upvotes: 24
Reputation: 6728
You need to specify the input for calling movements()
.
You can set default to the variable using this:
function movements(remove = null) {
so that the function won't break even if you don't give it the input.
You can default it to anything you like though.
Upvotes: 2