I have a table that I only want to show if one element on my data array from Google Sheets is not blank. The data array is returned from a search function (I enter an ID, and the function searches my Google Sheet).
So I tried all the following but all of them did not show the table at all even if it should've (the code for my table and return blank is all good, just the "if" part is what I don't get):
function table(dataArray) {
if(dataArray[2] !== "")
.
function table(dataArray) {
if(dataArray[2] === "<I inserted here the actual value of a non-blank cell>")
.
function table(dataArray) {
if(dataArray[2] !== null)
.
function table(dataArray) {
if(dataArray[2] && dataArray[2] !== undefined && dataArray[2].length != 0)
.
function table(dataArray[2]) {
if(dataArray[2] && dataArray[2] !== undefined && dataArray[2].length != 0)
CodePudding user response:
You can try a simple null check to see if the cell you are referring to is null using the code below:
if(!dataArray[2])