# Passing integer to Javascript for Inject Javascript

**URL:** <https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097>\
**Category:** Help\
**Tags:** studio\
**Created:** [June 13, 2019, 10:22pm UTC](https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097 "2019-06-13T22:22:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnarun1984](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/cnarun1984/32/44400_2.png) [@cnarun1984](https://forum.uipath.com/u/cnarun1984)\
**Post date:** [June 13, 2019, 10:22pm UTC](https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097/1 "2019-06-13T22:22:03Z")

</div>

How do I pass an integer to a Javascript as input parameter for Injeect Javascript activity?

---

<div class="post-metadata">

**Author:** ![KannanSuresh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kannansuresh/32/116003_2.png) [@KannanSuresh](https://forum.uipath.com/u/KannanSuresh)\
**Post date:** [June 14, 2019, 12:26am UTC](https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097/2 "2019-06-14T00:26:50Z")

</div>

Till now, we can pass parameters of Inject JS activity as a single string only.

To do integer operations, we need to accept parameters as string and then convert it to integer inside the JS code.

A script like below should work. If we pass the parameter as `37`, it should return `47`.

```
function addNumberWith10(e, a){
    var input = parseInt(a);
    var numberSum = input + 10;
    return numberSum.toString();
}

```

If we need to pass multiple parameters, we need to do a split within the JavaScript code because UiPath passes the parameter passed from activity as a single parameter.

If you note, I have returned the output value as string. This is another issue with UiPath. We can get output as integer if we use Inject JS activity with Internet Explorer. It will not work with Chrome.

See a bug I reported below.

> [@Inject JS Script (JavaScript) behaves differently in Internet Explorer and Chrome](https://forum.uipath.com/t/inject-js-script-javascript-behaves-differently-in-internet-explorer-and-chrome/115873):
>
> Scenario: I am trying to inject same JavaScript to both Internet Explorer and Chrome. Script is a simple one that returns number value 1. See the script below. function return1(){ return 1; } Same activity works fine with IE and results in an error when tried with chrome. See the details below. Steps to reproduce: Start a new process. Create a variable jsReturnValueFromIE of type Int32. Create a variable jsReturnValueFromChrome of type Int32. Add open browser activity and choose IE as br…

---

<div class="post-metadata">

**Author:** ![cnarun1984](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/cnarun1984/32/44400_2.png) [@cnarun1984](https://forum.uipath.com/u/cnarun1984)\
**Post date:** [June 14, 2019, 12:56am UTC](https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097/3 "2019-06-14T00:56:23Z")

</div>

> [@KannanSuresh](#):
>
> we need to do a split within the Ja

Thanks Kannan, that’s what I originally did but thought there should be a direct way 🙂

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [June 17, 2019, 12:56am UTC](https://forum.uipath.com/t/passing-integer-to-javascript-for-inject-javascript/125097/4 "2019-06-17T00:56:23Z")

</div>

Closed on June 17, 2019, 12:56am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
