'Combining two variables into a string for Google Scipts

I have the following script as part of an onEdit(e) function for a Google Sheets Spreadsheet:

//Add annual items to working area
if(col == 12 && row >= 31 && row < 54 && range.isChecked()){
var bill = range.offset(0,-3).getValue();
var dbill = range.offset(0, -1).getValue();
var amt = range.offset(0,1).getValue();
var due = range.offset(0, -1).getValue();

due.setFullYear(due.getFullYear() + 1);
Bu.getRange('P52').setValue(bill);
Bu.getRange('R52').setValue(amt);
range.offset(0,-1).setValue(due+' ('dbill')');
range.uncheck();
BillSort();
}​​

I'd like to change it so that bill and dbill are combined into a string like: bill (dbill) and then dropped into cell P52 rather than just bill.

My initial thinking was to use the following change:

Bu.getRange('P52').setValue(bill+' (' dbill')';​

but that didn't work. What is the proper/best method to use these two variable values in a string?



Solution 1:[1]

Bu.getRange('P52').setValue(bill + ' (' + dbill + ')');?

or

Bu.getRange('P52').setValue(`${bill} (${dbill})`);?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TheMaster