title: How to stringify an Integer in V8?
body: <p>I'm trying to stringify an integer in v8.</p>
  
  <p>The nearest I've come to success so far is using <code>String::Concat</code>.  I tried writing this method (in a node.js 9.11.1 native addon), but it doesn't compile.</p>
  
  <pre><code>void Method(const FunctionCallbackInfo&lt;Value&gt; &amp;args) {
    Isolate *isolate = args.GetIsolate();
  
    const int num = 42;
    args.GetReturnValue().Set(
        String::Concat(String::NewFromUtf8(isolate, "The num is: "),
                        Integer::New(isolate, num)));
  }
  </code></pre>
  
  <p>The compile error is:</p>
  
  <pre><code>'=': cannot convert from 'v8::Integer *' to 'v8::String *volatile '
  </code></pre>
  
  <p>I haven't been able to figure out the right parts of the v8 API to make use of to format an integer into a string.  I'm (perhaps obviously) not familiar with the v8 API, and I'm having trouble finding good examples to learn from.</p>
  
  <p>I was going by the answer to this question:  <a href="https://stackoverflow.com/questions/22379918/how-to-convert-an-integer-to-a-string-in-v8">How to convert an Integer to a String in V8?</a> although it appears to be stale compared to the modern v8 API.  The example appears to be pre-"isolate" for example.</p>
  
  <p>I was under the impression that Concat would accept this because in JavaScript it just coerces the int to a string (that seems to be the gist of that question I referenced).  But I guess maybe I have to be explicit about that when coding with v8?</p>
  
  <p>I'm sure it's something simple I'm missing. I'd appreciate someone suggesting a better way.</p>