How do you create an id for an element?

I successfully created a paragraph with:

var newLink = document.createElement('p'); //create paragraph

and tried (unsuccessfully) to create an id with:

newlink.setAttribute('id', 'noSug');

What's the right way?