Sexy JavaScript fault-tolerant.
var output = document
.try('querySelector', 'div')
.try('getAttribute', 'id')
.try('slice', 0, 5);
console.log(output);
Bower
bower install tryjs --save
Include the script located on the dist
folder.
<script src="dist/try.min.js"></script>
Or use the link CDN
<script src="//cdn.rawgit.com/dayvsonlima/try.js/master/dist/try.min.js"></script>