Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If statement replaced with short circuit evaluation #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
If statement replaced with short circuit evaluation
Short circuit evaluation increases the readability score
  • Loading branch information
sojinsamuel authored Jul 31, 2022
commit 305a74015aee5415bf58b92f66a579d67720c48d
4 changes: 2 additions & 2 deletions element.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export let create = (target, type, id, style, classname, content) => {
element.style.position = "absolute";
element.setAttribute("id", id);
element.setAttribute("class", "box");
if (classname) element.className = classname;
if (content) element.innerHTML = content;
classname && (element.className = classname);
content && (element.innerHTML = content);

Object.entries(style).map(entry => {
let [ property, value ] = entry;
Expand Down