If-else in javascript using ternary operator

We can use ?: instead of if else also in javascript. Here a example.

var str= 'C:\\fakepath\\'; 
document.getElementById('fakeFileTxt').value = (this.value.match(/fakepath/))? this.value : str.concat(this.value)


Reactions

Post a Comment

0 Comments