$(“#main”).append(“[name]”);
var email = "cameron@email.com"; var newEmail = email.replace("email.com","gmail.com"); console.log(email); console.log(newEmail); var formattedName = HTMLheaderName.replace("%data%", name); $("#header").append(formattedName)
The prepend() method inserts specified content at the beginning of the selected elements.
var formattedName = HTMLheaderName.replace("%data%", name); var role = "web developer"; var formattedRole = HTMLheaderRole.replace("%data%", role); $("#header").prepend(formattedName); $("#header").prepend(formattedRole);
var s = “audacity”;
s = s[1].toUpperCase() + s.slice(2);
var sampleArray = [0,0,7]; var incrementLastArrayElement = function(_array) { var newArray = []; newArray = _array.slice(0); var lastNumber = newArray.pop(); newArray.push(lastNumber + 1); return newArray; }; console.log(incrementLastArrayElement(sampleArray));
object
var bio = { "name":"john doe", "role":"web developer", "contacts":{ "mobile":"080-1234-5678", "email": "john@example.com", "github":"hohndoe", "twitter": "@johndoe", "location": "San Francisco" }, "welcomeMessage": "testtesttest", "skills": [ "awsomenss", "delivering things", "cryogenic sleep", "saving universe" ], "bioPic": "images/fry.jpg" }
object model
var work = {}; work.position = "web development"; work.employer = "more than 1000"; work.years = "0"; work.city = "yurakucho"; var education = {}; education["name"] = "nova southern university" education["years"] = "2005-2013" education["city"] = "fort lauderdale, fl, us" $("#main").append(work.position); $("#main").append(education.name);