Get first array property in object

by Chance Nursey-Bush

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

JavaScript

var obj = { 
	first: ['someVal','someVal2','codewith\nnewline'],
  	zillow: ['one'],
  second: ['first','second','third']
};
var returnObj = obj[Object.keys(obj)[0]]; //returns first property in object
alert(returnObj);
console.log(Object.getOwnPropertyNames(obj).sort());//get all properties of object sorted

//remove 'someval2' from array
returnObj = jQuery.grep(returnObj, function(value) {
  return value != 'someVal2';
});

//removes newlines from all string elements in array
returnObj = returnObj.map(function(a) { return a.replace(/(\r\n|\n|\r)/gm,""); });
alert(returnObj);