tonumber
An argument is interpreted as tring, "40" + "2"
results in "402"
$ jq --arg num1 40 --arg num2 2 -n '$num1 + $num2'
"402"
tonumber
transforms its input to a number:
$ jq --arg num1 40 --arg num2 2 -n '($num1 | tonumber) + ($num2 | tonumber)'
42