To my knowledge it is not possible to pass a string, but you can use a stream. And you can create a stream out of the string with a package called string-to-stream. Then you can simply use it like this:
var browserify = require('browserify');
const str = require('string-to-stream');
var b = browserify();
b.add(str("let a =1; console.log(a)"));
b.bundle((err, buffer)=>{
console.log(buffer.toString());
})