{"ScriptPreparationCode":null,"TestCases":[{"Name":"Using the spread operator","Code":"const searchParams = {};\r\nconst email = \u0022email\u0022\r\n // const email = getCookie(\u0022email\u0022);\r\n const firstname = \u0022firstname\u0022\r\n // const firstname = getCookie(\u0022firstname\u0022);\r\n const lastname = \u0022lastname\u0022\r\n // const lastname = getCookie(\u0022lastname\u0022);\r\n const phone = \u0022phone\u0022\r\n // const phone = getCookie(\u0022phone\u0022);\r\n\r\n // const cookieValues = {\r\n // email,\r\n // firstname,\r\n // lastname,\r\n // phone,\r\n // };\r\n let cookieValues = {\r\n ...(email \u0026\u0026 { email }),\r\n ...(firstname \u0026\u0026 { firstname }),\r\n ...(lastname \u0026\u0026 { lastname }),\r\n ...(phone \u0026\u0026 { phone }),\r\n }\r\n Object.assign(searchParams, cookieValues);","IsDeferred":false},{"Name":"Using Object.assign","Code":" const searchParams = {};\r\n\r\nconst email = \u0022email\u0022\r\n // const email = getCookie(\u0022email\u0022);\r\n const firstname = \u0022firstname\u0022\r\n // const firstname = getCookie(\u0022firstname\u0022);\r\n const lastname = \u0022lastname\u0022\r\n // const lastname = getCookie(\u0022lastname\u0022);\r\n const phone = \u0022phone\u0022\r\n // const phone = getCookie(\u0022phone\u0022);\r\n\r\n let cookieValues = {}\r\n if (email) { cookieValues.email = email}\r\n if (firstname) { cookieValues.firstname = firstname}\r\n if (lastname) { cookieValues.lastname = lastname}\r\n if (phone) { cookieValues.phone = phone}\r\n Object.assign(searchParams, cookieValues);","IsDeferred":false}]}