You can use a ternary operator as a shortcut for the if/else statement, like this:
times > 0 ? string.repeat(times) : "";
If you want to change selection, open document below and click on "Move attachment"
Three ways to repeat a string in JavaScript – freeCodeCamp2Fu%2F13507232%3Fv%3D3%26s%3D400&key=4fce0568f2ce49e8b54624ef71a8a5bd" data-media-id="577c9098b8ea4ad56d00f10ddffe3147" src="/media/577c9098b8ea4ad56d00f10ddffe3147?postId=2a9053b93a2d" height="250" width="700"><iframe><div> You can use a ternary operator as a shortcut for the if/else statement, like this: times > 0 ? string.repeat(times) : ""; This can be read as: if (times > 0) { return string.repeat(times);} else { return "";} You can then return the ternary operator in your function: <d Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details