Server-side JavaScript in the SFMC does not work with the DOM and will not function with exterior libraries. Instead, you can use libraries provided by the Salesforce Marketing Cloud application to create server-side JavaScript that works within landing pages. All functions native to JavaScript, such as arrays, math functions, the EVAL function, and try catch blocks, will work with server-side JavaScript.
You can duplicate the functionality of AMPScript
using server-side JavaScript. However, server-side JavaScript can also handle more advanced procedures:
- You can use arrays in your server-side JavaScript.
- You can use more advanced exception handling with server-side JavaScript.
If you are already familiar with JavaScript, you can immediately begin to use that knowledge in building emails and landing pages.
For more information:
Attribution to: Adam Spriggs
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33336