Posts

Showing posts from October, 2019

Beautify JSON String

var myObj = {hello: "World"};

JSON.stringify(myObj, null, 4);
// '{
// "hello": "world"
// }'

String and Number Conversion in JavaScript

var myString = "999";

// Convert String to a number
var myNumber = +myString; // → 999
// OR
var myNumber = Number(myString) // → 999

// Convert String to negative number
var myNegativeNumber = -myString; // → -999
// OR
var myNegativeNumber = -Number(myString) // → -999

Show hidden variables on Service Portal using browser console

Since Service Portal uses Bootstrap, You can use those bootstrap specific classes to perform the required action

$('.form-group.ng-hide').removeClass('ng-hide');